MySQL Forums
Forum List  »  Optimizer & Parser

Re: Join without duplicates
Posted by: Jørgen Løland
Date: November 29, 2011 02:58PM

I don't see how you can do that in a single query. I suggest you go for one of these:

a) Multiple queries
   1: select id, competitorname, competitordescription from competitor
   2: for each competitorid: select eventname, eventdescription, score
                             from event join scores on
                             where competitorid=<fill inn id here>
b) A single query, but filter the result in your application layer

I would most likely go for a). If consistency is a concern, just use a transaction.

Hope this helps,
Jørgen Løland
Software Engineer, MySQL, Oracle

Options: ReplyQuote

Written By
November 28, 2011 11:22AM
November 28, 2011 02:39PM
November 29, 2011 04:19AM
Re: Join without duplicates
November 29, 2011 02:58PM

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.