Reputation: 47
I couldnt find a clear answer to this questions, should be a simple one. Basically I am trying to get all computers that dont have word installed. This query seems to be giving me wrong data. Any ideas? Thanks!
SELECT DISTINCT Name
FROM dbo.vComputer AS v
WHERE Name NOT IN
(
SELECT Name
FROM dbo.vComputer
WHERE (dbo.vComputer.installedsoftware LIKE N'%word%')))
Upvotes: 1
Views: 101
Reputation: 28413
Try like this
With NOT EXISTS
SELECT Name
FROM dbo.vComputer AS V
WHERE NOT EXISTS
(
SELECT Name
FROM dbo.vComputer AS S
WHERE S.installedsoftware LIKE N'%word%'
)
WITH NOT IN
SELECT Name
FROM dbo.vComputer AS V
WHERE Name NOT In
(SELECT Name
FROM dbo.vComputer AS S
WHERE S.installedsoftware LIKE N'%word%'
);
Upvotes: 2