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

From: Date: Wed, 05 Aug 2009 00:22:42 +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 10 11 12  Groups: php.db 
Request: Send a blank email to php-db+get-46410@lists.php.net to get a copy of this message
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/

« previous php.db (#46410) next »