Hi,

thanks...

though I'm getting an error :-

Code :-

$query ="SELECT timetext, Time, groupa, country, value FROM_UNIXTIME(Time)
 FROM membercount t1 WHERE Time = (SELECT MAX(Time) FROM membercount t2 WHERE
  FROM_UNIXTIME(t1.Time, '%Y-%m-%d') = FROM_UNIXTIME(t2.Time, '%Y-%m-%d'))";

(timetext - see below)


the error im getting is :-

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'FROM_UNIXTIME(Time)
 FROM membercount t1 WHERE Time = (SELECT MAX(Time) FROM mem' at line 1


Although - I have found a code that does work (almost) - see below :-

========================================

Im almost there....

Ive added a new field - timetext, which is made up of 2007039 (2007, &
the 39th day of the year)...

I can now easily find one record for each day, however it picks out
the earliest record for the day, instead of the last record..  (EG it
picks the 3:32 a.m. record (if any), instead of the 11:23 p.m. record
(if any) )

Code :-

$query="SELECT DISTINCT timetext, Time, groupa, country, value FROM
membercount WHERE `country` = 'NZ' GROUP BY groupa, timetext ORDER BY
group DESC, Time ASC";



I've tried various combinations of ASC / DESC - however it always
seems to retrieve the earliest record...

(With & without the DISTINCT command)

-- 
G
NZ community groups - [EMAIL PROTECTED]
Freecycle Auckland :-
http://groups.yahoo.com/group/AucklandFreecycle/

Reply via email to