MySQL Forums
Forum List  »  Newbie

Re: Help!!!
Posted by: Claude Martin
Date: April 05, 2005 01:24AM

ok now i understand.

but what do you expect?
mysql now gets the max id of date and then every row in pump1 with that owner so thats 5 results. then it gets for every of them 5 rows 5 more from the next table so thats 5*5 = 25 rows.

now which row should be used for the 3rd table?
then you need to group i guess.
something like that:

SELECT date.id, pump1.id, `pump2`.id
FROM date
RIGHT JOIN pump1 ON date.id = `pump1`.owner
RIGHT JOIN pump2 ON pump1.owner = date.id
WHERE date.id = ( SELECT MAX( id ) FROM date )
GROUP BY date.id, pump1.id

http://animalliberation.tk http://veganismus.ch
http://maqi.de http://tierrechtskochbuch.de

Options: ReplyQuote


Subject
Written By
Posted
April 05, 2005 12:20AM
April 05, 2005 12:31AM
April 05, 2005 12:53AM
Re: Help!!!
April 05, 2005 01:24AM
April 05, 2005 01:43AM
April 05, 2005 03:17AM
April 05, 2005 04:57AM


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.