Click to See Complete Forum and Search --> : read two fields as one in mysql table


slyfox
08-19-2004, 05:25 PM
Hi

What I'm trying to do is:

Read all data from mysql table according to the dates (dd,mm,yyyy) found in the two fields (date1 and date2), the data needs to be sorted according to these dates.

Please, any ideas!!

Thank You

solavar
08-20-2004, 04:17 AM
What do date1 and date2 look like?

Are they both 'dd,mm,yyyy'?
Is one of them 'dd' and the other 'mm,yyyy'?

slyfox
08-20-2004, 05:39 PM
both are dd/mm/yyyy

solavar
08-20-2004, 10:45 PM
As long as the data type is DATE (as opposed to varchar, or similar) try the following:



//... connection

$sql = "SELECT * FROM mytable ORDER BY date1 DESC, date2 DESC";

$result = mysql_query($sql);