Re: newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?
| From: | Chris | Date: | Wed, 05 Aug 2009 22:26:28 +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-46418@lists.php.net to get a copy of this message | ||
Ford, Mike wrote:
That's a mysqlism :( It's not portable to other db's (apparently it's not part of the sql-spec). -- Postgresql & php tutorials http://www.designmagick.com/-----Original Message----- From: Govinda [mailto:govinda.webdnatalk@gmail.com] Sent: 05 August 2009 01:41Just one other tiny point of style here: having given the expression date(solarAWDateTime) the alias uniqueDate, you should probably use that alias to refer to the same thing elsewhere in your query, such as in the GROUP BY column. So: SELECT count(*) ASTaking this: SELECT count(*) ASCountUniqueDatesInMyTbl, date(solarAWDateTime) ASuniqueDate, 'aweber_7solar_aw' AStableAliasFROM aweber_7solar_aw GROUP BY DATE(solarAWDateTime)CountUniqueDatesInMyTbl,date(solarAWDateTime) ASFROM aweber_7solar_aw GROUP BYuniqueDate, 'aweber_7solar_aw' AStableAliasuniqueDate;