Reputation: 3675
Here is sql
SELECT DISTINCT
t1.`name` team1_name,
t1.id team1_id,
t2.id team2_id,
t2.`name` team2_name,
sc.`name_en` sportCatname,
c.title championshipTitle,
e.date eventDate,
e.id eventId,
e.title,
FROM
`Event` e,
`SportCategory` sc,
`Championship` c,
`Team` t1,
`Team` t2
WHERE
e.top = 1
AND t1.id = e.team1ID
AND t2.id = e.team2ID
AND sc.id = c.sportCategoryID
Tried with JOIN also. No way. It returns corrects rows but, in result set I have same row 2 times. What am I doing wrong?
Upvotes: 0
Views: 812
Reputation: 13700
Can you check if any column has a special characters that are not in other rows?
Upvotes: 0
Reputation: 3821
There is no relationship for SportCategory
and Championship
in the where clause. This is the reason for having duplicate results.
You should provide the relationship in the where
clause.
Upvotes: 1