Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Need Help!

Author  Topic 

themoney32
Starting Member

20 Posts

Posted - 2009-09-20 : 23:57:55
I am trying to find shipping orders where the shipping date is null and where the shippingcountry is USA, Mexico, or Canada. I also need to find the date of the oldest order that is null. I tried this...

SELECT count(*) FROM orders o WHERE ShippedDate is null AND ShipCountry = "USA", "Mexico", "Canada";

But I get a syntax error at the end. I also do not know how to add the oldest date on there either. Any help?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-09-21 : 00:11:08
[code]
SELECT count(*)
FROM orders o
WHERE ShippedDate is null
AND ShipCountry in ( 'USA', 'Mexico', 'Canada' )
[/code]

I also do not know how to add the oldest date on there either
use ORDER BY the date column in your query


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

themoney32
Starting Member

20 Posts

Posted - 2009-09-21 : 00:27:06
Thanks for that first part, I figured it out right before ya posted. But I still need the oldest date for the order that was not shipped in these. I dont know how I could use ORDER BY with the previous code so Im just stuck here
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-09-21 : 01:23:08
the prev code just a count*) of records what / how do you want to ORDER ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -