My database has two tables: ips, oips
ips.public field contains values: 1, 2, 3, 4, 5, 6, 7, 8
oips.public field contains values: 1, 3, 7
I want to select all values in ips.public that do not appear in oips.public
I'm using the following MySQL query within PHP:
SELECT * FROM ips, oips WHERE ips_ips.public != oips.public
This is returning the following:
1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8
As you can see, the values that exist in both tables are only shown twice, whilst everything else is displayed three times (presumably due to this iterating on both tables).
Could anybody please shed some light on how to have this code so that it'd only return the values that are not in both tables (aka: 2, 4, 5, 6, 8)
Thanks!