August 3, 2011 at 7:29 am
Hi,
I am trying to create a query based on the condition to display data where the ARRIVAL_SCHEDULE_DT is within the three months preceding the current date when the ship first arrives at a particular port, i.e. PORT_CD = 'BEZEE' (I work for a shipping company).
To explain further, below are the conditions in the WHERE clause of my query:
-----------------------
WHERE
AND MG_VSLVOY_SCHEDULE.ARRIVAL_SCHEDULE_DT < = dateadd(mm, 3, getdate())
AND PORT_CD IN ('BEZEE', 'GBSOU', 'MXVER', 'USGLS', 'USJAX', 'USBAL', 'USCHS', 'USSSI')
------------------------------------------
If you see the next line of code, you will find that the report needs to include all the PORT_CD's mentioned so I cannot just include PORT_CD = 'BEZEE' as that would filter out the other PORT_CDs.
Any help would be appreciated.
Regards,
Paul
August 3, 2011 at 7:35 am
You think we'll help more here than on the other thread.???
HELP US HELP YOU.
August 3, 2011 at 7:36 am
I think you missed a typo in your post
AND MG_VSLVOY_SCHEDULE.ARRIVAL_SCHEDULE_DT >= dateadd(mm, -3, getdate())
No more replies here please, continue the discussion here : http://www.sqlservercentral.com/Forums/Topic1153351-149-1.aspx
August 3, 2011 at 7:48 am
Ninja's_RGR'us (8/3/2011)
I think you missed a typo in your postAND MG_VSLVOY_SCHEDULE.ARRIVAL_SCHEDULE_DT >= dateadd(mm, -3, getdate())
No more replies here please, continue the discussion here : http://www.sqlservercentral.com/Forums/Topic1153351-149-1.aspx
okay you win Ninja, you never give up on helping others, do you ?....but even then the code I created is wrong, it doesnt get the desired results even if you leave out the PORT_CD part....okay if you really want to help me...pls read this link, this is different from what I asked initially and it really does not require me to post the DDLs and sample data cos its just a syntax modification:
http://www.sqlservercentral.com/Forums/Topic1153535-149-1.aspx
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply