I have the following sample table (tbl_Local) in MySQL:
ID| LOCAL| COR
1 | A |RED
2 | A |RED
3 | B |RED
4 | B |BLACK
5 | B |WHITE
6 | C |RED
7 | D |BLUE
8 | E |BLUE
9 | E |ORANGE
10| E |YELLOW
11| E |RED
12| F |RED
13| G |ORANGE
14| G |BLUE
15| H |ORANGE
I would like to create a select that returns ONLY the places that have EXCLUSIVELY the color RED , ie, has another LOCAL
that is not just the RED it should not be displayed.
In this table for example the return should be:
LOCAL| COR
A |RED
C |RED
F |RED
I tried to use the following syntax:
Select tbl_Local.*, count(distinct(COR)) from tbl_Local where COR = 'RED' Group By LOCAL
But it did not work, and I'm out of ideas.