Re: MySQL Order by 2 date fields

2004-10-04 Thread SGreen
I agree with keeping only dates or nulls in a date-type column. One other option, you could use a NULL value for ModifyDate with the COALESCE() function like this SELECT, COALESCE(ModifyDate, CreationDate) as recordDate FROM ... WHERE ... ORDER BY recordDate if ModifyDate is not null, that

Re: MySQL Order by 2 date fields

2004-10-04 Thread Eldo Skaria
Hi Khan, I would klike to approach ur problem in a diffrent manner. My suggestion is that, in both the date fields u use dates only. (I don't know the useabilty of '0' in a date field). While using this, u have to store the creation time a the modification time, at the creation of record. This is t

Re: MySQL Order by 2 date fields

2004-10-04 Thread Paul
On Mon, 4 Oct 2004 11:03:13 +0200, Martijn Tonies <[EMAIL PROTECTED]> wrote: > Hello, > > > I have two date fields (1095689105) in mysql. One is Creation date and > > other is Modify date. If news is not modified its value is 0. How can I > > sort my news so modify date is more important (if exist

Re: MySQL Order by 2 date fields

2004-10-04 Thread Martijn Tonies
Hello, > I have two date fields (1095689105) in mysql. One is Creation date and > other is Modify date. If news is not modified its value is 0. How can I > sort my news so modify date is more important (if exists) than creation > date? What about an ORDER BY with a CASE statement that uses the Cr