SQL report show all computers with old applications (inner join)
I'm using SQL to generate a report. I'm trying to provide all computers with old applications (which are in any collection called *old*)
I've troubles with the correct syntax at the second "inner join"
the result is correct for the columns Collections.Name, Collections.ComputerCount, CollectionComputers.ComputerId
but not for the second inner join: the columns Computers.Name and omputers.ComputerId
SELECT
Collections.Name AS Collection,
Collections.ComputerCount,
CollectionComputers.ComputerId,
Computers.Name as Computer,
Computers.ComputerId as id
FROM
Collections
INNER JOIN CollectionComputers ON Collections.CollectionId = CollectionComputers.CollectionId
INNER JOIN Computers ON Computers.ComputerId = CollectionComputers.CollectionId
WHERE Collections.Name LIKE '%Old)%' AND Collections.ComputerCount > 0
ORDER BY Collections.Name
Comments