Board index » delphi » I think it's an SQL question?

I think it's an SQL question?

I'm trying to single out the month and day of a date in an SQL query.

can anyone help me?

I need to list the dates by order of month and day... not year.

thanks,
Jeff
pier0...@tc.umn.edu

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

 

Re:I think it's an SQL question?


Quote
On Thu, 01 Oct 1998 20:19:25 GMT, dead_jim_morri...@my-dejanews.com wrote:
>I'm trying to single out the month and day of a date in an SQL query.

>can anyone help me?

>I need to list the dates by order of month and day... not year.

Use the SQL function EXTRACT to retrieve just the day or month portion of a
DATE or TIMESTAMP column. Reference them in the ORDER BY clause. For
example:

  SELECT EXTRACT(MONTH FROM DateCol), EXTRACT(DAY FROM DateCol), DateCol
  FROM YourTable
  ORDER BY 1, 2

//////////////////////////////////////////////////////////////////////////
Steve Koterski                      "The knowledge of the world is only to
Technical Publications              be acquired in the world, and not in a
INPRISE Corporation                 closet."
http://www.inprise.com/delphi          -- Earl of Chesterfield (1694-1773)

Other Threads