Re: newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?
| From: | Govinda | Date: | Wed, 05 Aug 2009 20:27:32 +0000 |
| Subject: | Re: newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column? | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46416@lists.php.net to get a copy of this message | ||
Me/this again.
this works good:
$query = "SELECT COUNT(*) AS
CountUniqueDatesInMyTbl, date(solarLandingDateTime) AS uniqueDate, 't7solar_landing' AS tableAlias FROM t7solar_landing GROUP BY uniqueDate ORDER BY uniqueDate DESC LIMIT 62 UNION ALL SELECT count(*) AS CountUniqueDatesInMyTbl, date(solarAweberConfDateTime) AS uniqueDate, 'aweber_7solar_confirm' AS tableAlias FROM aweber_7solar_confirm GROUP BY uniqueDate ORDER BY uniqueDate DESC LIMIT 62 UNION ALL SELECT count(*) AS CountUniqueDatesInMyTbl, date(solarAWDateTime) AS uniqueDate, 'aweber_7solar_aw' AS tableAlias FROM aweber_7solar_aw GROUP BY uniqueDate ORDER BY uniqueDate DESC LIMIT 62";
except that I just added the ORDER BY clause onto each SELECT segment, and now I get this error:
query failed: Incorrect usage of UNION and ORDER BY
How can I order the results while still doing the UNION ALLs?
-Govinda