Subject | select query |
---|---|
Author | petr.jakes |
Post date | 2010-01-30T01:10:05Z |
I know, very common question here but...
Just to simplify the problem, two simple table:
Person:
ID, NAME
Message:
ID, PERSON_ID, SUBJECT, TIMESTAMP
I would like to have SELECT, which returns:
Person.NAME, Message.SUBJECT, Message.TIMESTAMP
where the rows included in the SELECT results are the rows with the youngest TIMESTAMP for each NAME only. SELECT MAX does not work, because Message.SUBJECT values in the table are unique.
Thanks for your comments/suggestions.
Petr
Just to simplify the problem, two simple table:
Person:
ID, NAME
Message:
ID, PERSON_ID, SUBJECT, TIMESTAMP
I would like to have SELECT, which returns:
Person.NAME, Message.SUBJECT, Message.TIMESTAMP
where the rows included in the SELECT results are the rows with the youngest TIMESTAMP for each NAME only. SELECT MAX does not work, because Message.SUBJECT values in the table are unique.
Thanks for your comments/suggestions.
Petr