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

From: Date: Tue, 04 Aug 2009 14:48: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  Groups: php.db 
Request: Send a blank email to php-db+get-46398@lists.php.net to get a copy of this message
I should have given an example .. select count(*) as record_count, date(column_name) as date_field, 'my_table' as table_name union all select count(*) as record_count, date(column_name) as date_field, 'my_table_2' as table_name and end up with:
count | date       | table_name
-------------------------------
5     | 2009-01-01 | table 1
10    | 2009-01-01 | table 2
Ben, Chris, This is as far as I could get so far: $query = "SELECT COUNT(*) AS landing_count, date(solarLandingDateTime) AS solarLandingDate, 't7solar_landingALIAS' AS t7solar_landing UNION ALL SELECT count(*) AS confirm_count, date(solarAweberConfDateTime) AS solarAweberConfDate, 'aweber_7solar_confirmALIAS' AS aweber_7solar_confirm UNION ALL SELECT count(*) AS thankyou_count, date(solarAWDateTime) AS solarAWDate, 'aweber_7solar_awALIAS' AS aweber_7solar_aw"; $foundUniqueDateROWS = mysql_query($query) or die("query failed: " .mysql_error()); giving this error: query failed: Unknown column 'solarLandingDateTime' in 'field list' but I most certainly do have a column named 'solarLandingDateTime' in the table named 't7solar_landing'. So I am not sure what it's unhappy. ? ------------ John Butler (Govinda) govinda.webdnatalk@gmail.com

« previous php.db (#46398) next »