Gareth,

Try something like:

SELECT
     date_id,
     date1,
     date2,
     greatest(date1,date2) AS theDate
FROM
     tbl_date
ORDER BY
     theDate


Theres also a LEAST() function in MySQL... if you need to do the reverse.

cheers,
____________________________
James Silva
Web Production
Gruden Pty Ltd

Tel:   +61 02 9956 6388
Fax:   +61 02 9956 8433
Email: [EMAIL PROTECTED]
Web:   http://www.gruden.com
____________________________


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Gareth
Sent: Monday, September 22, 2003 3:51 PM
To: CFAussie Mailing List
Subject: [cfaussie] SQL Sorting.


Hi peoples.

I'm using MySQL for my database stuff. Just a quick question, when sorting I
have 2 fields I need to sort by,

Both are date fields, but I need to sort them like they are one field. IE
have the dates listed in the correct order at the moment all I can do is
sort one, then the other. Giving me a list of records for the one Date field
sorted seperately for the other.

If anyone can help me that would be great.

Cheers

Gareth.


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to