Re: Join without duplicates
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 scores.eventid=event.id
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
jorgenloland.blogspot.com
Subject
Views
Written By
Posted
4123
November 28, 2011 11:22AM
1300
November 28, 2011 02:39PM
1631
November 29, 2011 04:19AM
Re: Join without duplicates
1797
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.