This query is pretty self explanatory:
$networks = '6,7,8';
$query = "SELECT DISTINCT countryName
FROM countries AS Country
INNER JOIN countries_networks AS n ON Country.id = n.country_id
WHERE n.network_id IN (".$networks.")";
However, if I want to select the network number 8, but NOT 6,7, how would I do that?
kind of a IN('8') but NOT IN('6,7')
The use of IN() is a not requirement.
I am after the countries that ONLY have a network of 8. The reason being is that I have 2 levels of cell-phone. Say, the ‘scumbag-phone’ that works in networks 6 & 7, and the ‘Uber-phone’ that works in networks 6,7 & 8.
I want to get the countries where it is essential that you have an Uber-phone (8 only). At the moment these queries will get 8, but not exclusively. They pay no heed to the fact that there may also be 6,7 in there, deeming the Uber-phone non-essential.
1 Answer