thank, now i understand how to use the MAX() properly, but i still have a problem. The SQL statement you gave me will only selects the latest date for one of the "tables". What if i wanted to pick up the latest date for each of the "tables"
Ex:
Classroom2Name: | Date:
Oliver | 10-10-10
Homer | 08-10-10Classroom1
Name: | Date:
James | 20-10-10
Lars | 01-10-10I want both of the greens to be displayed. MAX() will only get the 20-10-10 right? and i will not be able to select the other then...
Picky Picky Picky..
Try this:
(Select *
from mytable
where mytable.classroom = 'Classroom1'
and mytable.date = (select max(date)
from mytable where classroom = 'Classroom1')
) UNION (
Select *
from mytable
where mytable.classroom = 'Classroom2'
and mytable.date = (select max(date)
from mytable where classroom = 'Classroom2')
)