I have a query that should return me all users out of the special area. If i had areas, the result still the same
SELECT users.id AS id, SUBSTRING(users.zipcode, 1, 2)
FROM users JOIN country ON users.country_id = country.country_id
WHERE country.country_code NOT IN ('AD','AF','BE')
OR (country.country_code = 'FR' AND SUBSTRING(users.zipcode, 1, 2)
NOT IN (69,38,26,07,42))
id | user_zipcode | country_code
1 | 38 | FR
1 | 69 | BE
I don't want all users with country_code 'AD','AF','BE' but if country_code is "FR" i don't want only those with the user_zipcode's 69,38,26,07,42