MySQL Forums
Forum List  »  Optimizer & Parser

Re: Query
Posted by: Jorge Ferreira
Date: March 15, 2006 11:17AM

Ladies and Gentleman.
Looks like i've solved it. And if some of you it whas elementar, well for me it was a bit of a pain. So for all the others who it might interest here it goes:

SELECT DISTINCT registo.id_reg, (SELECT pagamento.data_pagamento FROM pagamento WHERE id_reg=registo.id_reg ORDER BY data_pagamento DESC limit 0,1) as data_pagamento
FROM registo
LEFT JOIN pagamento on registo.id_reg = pagamento.id_reg

It worked for me. Hope it works for someone else.

Regards,

Jorge

Options: ReplyQuote


Subject
Views
Written By
Posted
2597
March 15, 2006 11:08AM
Re: Query
1906
March 15, 2006 11:17AM
1877
March 15, 2006 11:37AM
1785
March 17, 2006 08:38AM


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.