mysql single query for two tables
Posted on 2014-02-25
how can i combine the following into one query.
the two tables are unrelated lists of IP addresses, one a whitelist and one a blacklist of IP addresses. I want to to return nothing IF the IP address IS ANYWHERE in the whitelist
Thus whitelist takes precedence in the logic, over the blacklist.
SELECT blacklist.* FROM blacklist, whitelist
BUT NULL RESULTS IF COUNT(whitelist.IPaddress='$IPaddress')>0
i need to do this within one query due to the way i'm executing it via a single shell command.