RE: newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Govinda [mailto:govinda.webdnatalk@xxxxxxxxx]
> Sent: 05 August 2009 01:41
> 
> > Taking this:
> > SELECT count(*) AS
> > `CountUniqueDatesInMyTbl`, date(solarAWDateTime) AS `uniqueDate`,
> > 'aweber_7solar_aw' AS `tableAlias` FROM aweber_7solar_aw GROUP BY
> > DATE(solarAWDateTime)

Just 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(*) AS `CountUniqueDatesInMyTbl`,
       date(solarAWDateTime) AS `uniqueDate`,
       'aweber_7solar_aw' AS `tableAlias`
   FROM aweber_7solar_aw
   GROUP BY `uniqueDate`;

That's how I'd write it, anyway.


Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.ford@xxxxxxxxxxxxxx 
Tel: +44 113 812 4730





To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux