Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

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

0

Comments

0 comments