I have a table news, a table category and a table bridge.
I want to select news with category ID = 1 or 2 or 3.
Example:
SELECT *
FROM NEWS
INNER JOIN BRIDGE ON NEWS.ID = BRIDGE.ID_NEWS
WHERE BRIDGE.ID_CATEGORY IN (1,2,3)
Problem is that when i do a select i have the second news (NEWS.ID = 2) duplicated.
I can't use distinct and anyway distinct not resolve the problem when i use pagination.
SCENARIO:
TABLE NEWS
|ID|TITLE|
|1 |First new|
|2 |second new|
|3 |third new|
TABLE CATEGORY
|ID|TITLE|
|1 |Great|
|2 |Bad |
|3 |Green|
TABLE BRIDGE
|ID_NEWS|ID_CATEGORY|
|1 |1
|2 |1
|2 |2
|3 |3
Results are:
First new, second new, second new, third new.
I want:
First new, second new, third new.
How can I have no duplicates?