Hiya,
I'm trying to work out the following query:
SELECT did_numbers.did_dialstring,
netareas.netarea_name,
did_numbers.did_size,
CASE WHEN (reseller_id < 1) IS NULL THEN 'F'
ELSE 'T'
END as reseller,
COUNT(*) AS aantal
FROM did_numbers
LEFT JOIN reseller_numbers ON (did_numbers.did_number = reseller_numbers.did_number AND reseller_numbers.did_number NOT IN(
SELECT did_number
FROM reseller_numbers
WHERE did_number
REGEXP '^31([0-9]{2,3})71([0-9]{4,5})$'
))
LEFT JOIN netareas ON did_numbers.did_dialstring = netareas.netarea_code
WHERE did_numbers.did_number NOT IN (
SELECT did_number
FROM did_numbers
WHERE did_number
REGEXP '^31([0-9]{2,3})71([0-9]{4,5})$'
)
GROUP BY did_numbers.did_dialstring, did_numbers.did_size, reseller
ORDER BY did_numbers.did_dialstring, reseller ASC
However, it does not seem to work. What happens is the numbers that are found in the subquery's are still counted. What am i doing wrong?
Thanks guys.