I have two tables with different data and I would like to join result in order to get data from both avoiding duplicates.
Table1:
Seasons | Colors
win 17 | grey
win 17 | blue
win 18 | red
win 18 | black
Table2:
Seasons | Sizes | Weights
win 17 | 48 | 8
win 17 | 47 | 7
win 17 | 48 | 5
win 17 | 47 | 9
win 18 | 42 | 2
win 18 | 43 | 3
win 18 | 42 | 4
win 18 | 43 | 1
Joining to something like :
Seasons | Sizes | Weights | Colors
win 17 | 48 | 8 | grey
win 17 | 47 | 7 | grey
win 17 | 48 | 5 | grey
win 17 | 47 | 9 | grey
win 17 | 48 | 8 | blue
win 17 | 47 | 7 | blue
win 17 | 48 | 5 | blue
win 17 | 47 | 9 | blue
win 18 | 42 | 2 | red
win 18 | 43 | 3 | red
win 18 | 42 | 4 | red
win 18 | 43 | 1 | red
win 18 | 42 | 2 | black
win 18 | 43 | 3 | black
win 18 | 42 | 4 | black
win 18 | 43 | 1 | black
I have tried
SELECT
Seasons,
Sizes,
Weights,
Colors
FROM (SELECT
Seasons,
Colors
FROM Table1) c
CROSS JOIN (SELECT
Sizes,
Weights
FROM table2) s
WHERE c.Seasons = s.Seasons
GROUP BY Seasons,
Colors,
Sizes,
Weights;
But I get duplicate colors on same season with different sizes and codes