ID Colour colour Size
== Table 1 == ==== Table 2 ====
1.** | **Blue** **Blue** | Big
2. | Red **Blue** | Average
3. | Yellow **Blue** | **Small**
4. | Orange Purple | Big
5. | Pink Grey | Average
6. | Green Red | Big
Hi,
In the above table, in MySQL I need to return any ID that does not have a value of ‘Small’. I am having trouble as if I tell it to not include ‘Size’ as ‘Small’ is still returns ‘ID 1.’ because the colour blue still has a value that is allowed (Big + Average).
I need a statement that will ignore Blue entirely (therefore not return ID 1.) because it has small linked to a colour in table 2.
Apologies if ive made this more confusing than it is. Im new to cross referencing two tables.
Select Table1.ID
from Table1, Table2
where Table1.colour = Table2.colour
and table2.size != Small
I think I need an inner join query, or Not Exist statement?
Any help would be appreciated
No need for inner joins. You had syntax errors though: