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]

 




With a union the columns have to have the same name (or alias).

Eg:

SELECT
 COUNT(*) AS count,
 date(solarLandingDateTime) AS unique_date,
 't7solar_landingALIAS' AS origin
 FROM tablename
UNION ALL
SELECT
 count(*) AS count,
 date(solarAweberConfDateTime) AS unique_date,
 'aweber_7solar_confirmALIAS' AS origin
 FROM tablename

etc

Correction the column names will come form the first query, but they need to be the same datatype in those columns. So if the first query has a date datatype, the subsequent queries must have date columns in the first position

Thanks for the correction, I thought the column names/aliases had to match but you're right.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
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