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

2009-08-03 Thread Govinda
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 -

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

2009-08-03 Thread Chris
Chris wrote: Ben Dunlap wrote: > ...which will echo: "#records in 't7solar_landing' matching the given (iterating) date (in the 'solarLandingDateTime' column)#records in 'aw_7solar_confirm' matching the given (iterating) date (in the 'solarAwConfDateTime' column)#records in 'aw_7solar_aw' ma

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

2009-08-03 Thread Chris
Ben Dunlap wrote: > ...which will echo: "#records in 't7solar_landing' matching the given (iterating) date (in the 'solarLandingDateTime' column)#records in 'aw_7solar_confirm' matching the given (iterating) date (in the 'solarAwConfDateTime' column)#records in 'aw_7solar_aw' matching the giv

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

2009-08-03 Thread Ben Dunlap
> ...which will echo: > "#records in 't7solar_landing' matching the given (iterating) > date (in the 'solarLandingDateTime' column)#records in > 'aw_7solar_confirm' matching the given (iterating) date (in the > 'solarAwConfDateTime' column)#records in 'aw_7solar_aw' > matching the given (iterati

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

2009-08-03 Thread Chris
Govinda wrote: .. so my thought is to want to do nested query(ies), where: *within* the while loop of the first recordset (which is now successfully returning just rows with unique dates), I do other query(ies) which will (in their own code block) find all rows of the date we are iterating.. so

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

2009-08-03 Thread Govinda
.. so my thought is to want to do nested query(ies), where: *within* the while loop of the first recordset (which is now successfully returning just rows with unique dates), I do other query(ies) which will (in their own code block) find all rows of the date we are iterating.. so I can, for examp

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

2009-08-03 Thread Jack van Zanen
Just keep in mind that while that may be a very possible solution when datasets are small. This could get problematic when for instance there are a 10 years worth of dates and millions of records in the other tables. The resulting program could end up taking lots of time to display data. In your ca

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

2009-08-03 Thread Ben Dunlap
Govinda wrote: > .. so my thought is to want to do nested query(ies), where: > *within* the while loop of the first recordset (which is now > successfully returning just rows with unique dates), I do other > query(ies) which will (in their own code block) find all rows of the > date we are iterat

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

2009-08-03 Thread Govinda
Bastien, I had tried it with the parantheses around the date for the distinct. I tried again just now. Same result. But that's ok. I am onto the next step now. Niel, Jack, I got your fix working. It shows me that I am still so new; I own yet so little mastery of MySQL. Nisse, I see

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

2009-08-03 Thread Phpster
On Aug 3, 2009, at 12:29 AM, Govinda wrote: Oops, forgot to mention that with the alias you can change the ORDER BY clause to use the aliased column data: ORDER BY solarLandingDate DESC this will only use the returned data instead of the entire column. If you are aliasing a column it

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

2009-08-03 Thread Nisse Engström
On Mon, 3 Aug 2009 11:52:11 +0200, Nisse Engström wrote: > You could use the date as an index: > > ... SELECT DATE(`datetimecolumn`) AS `date` ... > > while ($TrackingRow = mysql_fetch_object (...)) { > $data[$TrackingRow['date']] = $TrackingRow; > /* Store the last row from each set

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

2009-08-03 Thread Nisse Engström
On Sun, 2 Aug 2009 16:30:35 -0600, Govinda wrote: > I'm translating some code from another server-side language into PHP, > and I need something that 'summarizes' results found from a MySQL > SELECT. I.e. - > > $foundTrackingRows=mysql_query("SELECT... > while ($TrackingRow = mysql_fetch_obj