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 2000 Forums
 SQL Server Development (2000)
 Help with CONVERT and dates

Author  Topic 

supeg
Starting Member

6 Posts

Posted - 2004-11-04 : 15:55:02
Hello.

I just found this site today, and it is a very informative site, I love it!

Having some problems with CONVERT and date.

We are using the Microsoft Northwind example database.

Anyways, What I am supposed to do is Show a row that includes the Earliest and Latest dates for the OrderDate field

in the Orders table. That would be easy except that we must convert the date to show Month Day,Year EG July 21,

2001.

So far I got this for the Min/Max

SELECT MIN(OrderDate) AS "Earliest", MAX(OrderDate) AS "Latest"
FROM ORDERS;

And figured out how to do the CONVERT doing this

CONVERT(varchar(12),OrderDate,107)

But how do I put them together so it converts the query answers?

I tried a whole bunch of stuff, but to no avail.

Any ideas?

Thank you very much for the help!

VIG
Yak Posting Veteran

86 Posts

Posted - 2004-11-04 : 16:09:34
SELECT convert(varchar(12),MIN(OrderDate),107) AS Earliest
, convert(varchar(12),Max(OrderDate),107) AS Latest
FROM ORDERS
Go to Top of Page

supeg
Starting Member

6 Posts

Posted - 2004-11-04 : 16:24:43
Thank you very much!

I knew it was some sort of nesting, just couldnt figure it out.

Again thanks a lot!
Go to Top of Page
   

- Advertisement -