Hi there, im thinking of doing a new MYSQL database and have a small
MYSQL query, that (if possible) could be answered before I start...


Basically, I'll have 3 fields


time, name, value

The "time" field will contain the value of the time() function,


& the database will be updated / added to  3-4 times a day..


Eg :-


1, name1, 12
1234, name2, 3
3479, name1, 12
5467, name2, 5
7689, name1, 14
7893, name2, 6

There will be 3-4 name/value combintions for each day...)


(ive not used actual time values :) - but its just an example )

MAIN QUESTION :-

Is it possible, with a MYSQL query, to obtain all the rows for the
last time that occur before midnight on each day ?

example :

if I have

Sat 15th 1 a.m, name1, 12
Sat 15th 7 a.m, name1, 12
Sat 15th 1 p.m, name1, 14
Sat 15th 7:p.m, name1, 14
Sun 16th 1:a.m, name1, 15
Sun 16th 7:a.m, name1, 16
Sun 16th 1:p.m, name1, 18
Sun 16th 7:p.m, name1, 18
Mon 17th 1 a.m., name1, 19

(i'll use the time() function/value - Ive just used words to make it clear)

In the above, I only want the last value of each day - In this example :-

Sat 15th 11:p.m, name1, 14
Sun 16th 11:p.m, name1, 18
Mon 17th 1 a.m., name1, 19

Is this easy with a MYQL query, or will i need to 'get' all the values
& do a foreach on it ?

PS - Depending on my cron-job/scheduled tasks - the times will NOT be
exactly 6 hours apart - It depends on other processing requirements...

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

Reply via email to