MySQL Forums
Forum List  »  Newbie

[SQL] Left join order
Posted by:
Date: July 07, 2009 04:25AM

i have a 1:n relation between two tables:

clients (id, name)
events (client, state, date)

I want to create a join query to get ALL clients with date and state in order of last event date.
For example, with this data:

client: (1,John)
events: (1,ready, 2009/1/1),(1,broken, 2009/2/2),(1,repaired, 2009/3/3)

I want this:
(1, John, repaired, 2009/3/3)
because this is the last stat, so i need an ordered join by date DESC.... i hope you can understand my trouble :-)

Thank you.

Options: ReplyQuote

Written By
[SQL] Left join order
July 07, 2009 04:25AM
July 07, 2009 04:36AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.