R
rdemyan via AccessMonster.com
I cannot figure out why the following SQL statement is not producing the
correct results:
SELECT Site, Count(BUILDING_ID) AS [Bldg Count]
FROM [TABLEA]
WHERE Site NOT IN (SELECT Site FROM [TableB] WHERE ALLOWED_TO_VIEW = True And
User_ID = 'john_doe')
GROUP BY Site
ORDER BY Site;
If you select Site from each of the tables and group by Site, you find that
TableA has 76 sites and TableB has 75 sites. So why wouldn't the one site
that is in TableA but not in TableB be returned. Both tables have a null site
(not my doing, but I have to live with it).
correct results:
SELECT Site, Count(BUILDING_ID) AS [Bldg Count]
FROM [TABLEA]
WHERE Site NOT IN (SELECT Site FROM [TableB] WHERE ALLOWED_TO_VIEW = True And
User_ID = 'john_doe')
GROUP BY Site
ORDER BY Site;
If you select Site from each of the tables and group by Site, you find that
TableA has 76 sites and TableB has 75 sites. So why wouldn't the one site
that is in TableA but not in TableB be returned. Both tables have a null site
(not my doing, but I have to live with it).