Fwd: Re: Selecting with JOIN, GROUP BY and MAX

2003-07-22 Thread simon blenkinsop
OK, now we are both confused. There is only 1 instance of each unit in the unit table. Unit_id id the primary key. There are thousands of instances of each unit in the log table. Each record in this table holds unit_id, temperature and date. If I understand correctly, your suggested q

Re: Selecting with JOIN, GROUP BY and MAX

2003-07-22 Thread John Larsen
Geez, do I have to do all your work for you, :) First thing I can think of is, Ok this makes no sence you have a units table with unit_id as its main descriptor, but there can be several cases with the same unit_id but you want the one with the max date. Date on the other hand is stored in anoth

Selecting with JOIN, GROUP BY and MAX

2003-07-22 Thread simon blenkinsop
I have a table containing the fields unit_id, temperature and date. This has data for around 20 units, with many 1,000's of records for each. Further information on each unit is in another table with just 1 entry per unit. I need to select the most recent record for each unit together with its ass