Re: [PHP] Sorting mySQL query - one order from multiple fields

2009-07-26 Thread George Langley
In case anyone else was wondering, the command to use is COALESCE() as in: $theQuery = mysql_query(select variousFields from theTable where date = '$currDate' ORDER BY COALESCE(rotime2,rotime1,time)); COALESCE() will use one of the variables, being the one it finds a value for first,

[PHP] Sorting mySQL query - one order from multiple fields

2009-06-14 Thread George Langley
Hi all. Am trying to sort baseball games by time, where there can be up to 3 times listed per game. Each game has an original date and time field, plus fields for 2 rain-out dates/times (rodate1 rotime1, rodate2, rotime2), to use if the game gets rained out. Note that rotime1 and rotime2