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]

 



Niel, thanks (I was wondering about that... thought it seemed odd without a FROM clause)

Now I have this:

$query = "SELECT COUNT(*) AS landing_count, date(solarLandingDateTime) AS solarLandingDate, 't7solar_landingALIAS' AS t7solar_landing FROM t7solar_landing GROUP BY DATE(solarLandingDateTime) UNION ALL SELECT count(*) AS confirm_count, date(solarAweberConfDateTime) AS solarAweberConfDate, 'aweber_7solar_confirmALIAS' AS aweber_7solar_confirm FROM aweber_7solar_confirm GROUP BY DATE(solarAweberConfDateTime) UNION ALL SELECT count(*) AS thankyou_count, date(solarAWDateTime) AS solarAWDate, 'aweber_7solar_awALIAS' AS aweber_7solar_aw FROM aweber_7solar_aw GROUP BY DATE(solarAWDateTime) "; $foundUniqueDateROWS = mysql_query($query) or die("query failed: " .mysql_error());
while ($uniqueDateROW = mysql_fetch_assoc($foundUniqueDateROWS)) {
	echo "<tr>
	<td>".htmlentities($uniqueDateROW->solarLandingDate)"</td>
	<td>".htmlentities($uniqueDateROW->landing_count)."</td>
	<td>".htmlentities($uniqueDateROW->thankyou_count)."</td>
	<td>"."(some math coming)"."</td>
	<td>".htmlentities($uniqueDateROW->confirm_count)."</td>
	<td>"."(some math coming)"."</td>
	<td>"."(some math coming)"."</td>
	</tr>";
}

Which seems to be outputting (I assume) the correct number of records (one for each unique date in each of the 3 tables, combined).

But those table cells are coming out empty; i.e.
$uniqueDateROW->solarLandingDate
and
$uniqueDateROW->landing_count
are returning nothing.

Can someone point me to understand why?  I thought that:
SELECT COUNT(*) AS landing_count, date(solarLandingDateTime) AS solarLandingDate, 't7solar_landingALIAS' AS t7solar_landing FROM t7solar_landing GROUP BY DATE(solarLandingDateTime) would, among other thing, assign the number of records counted in that first table to the alias 'landing_count'. No?

I know it is annoying to hand-hold when newbies are this clueless. It's just hard for me to even know where to study when there are many blanks in my understanding. I am going to systematically plod through my books once I get them here. Meanwhile thanks to all who make time to help!

-Govinda

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