A simple query that should be looking into systemSoftware table and software table and displaying only the softwareId that are not inside the systemSoftware table.
Here is my query so far…
SELECT s.softwareId AS 'Software ID',
s.softwareDescription AS 'Software Description',
sv.vendorName AS 'Vendor Name',
c.cityName AS 'City Name'
FROM software AS s
JOIN systemSoftware AS ss
ON s.softwareId = ss.softwareId
JOIN softwareVendor AS sv
ON s.vendorId = sv.vendorId
JOIN city AS c
ON sv.zipCode = c.zipCode
WHERE s.softwareId NOT IN (ss.softwareId)
ORDER BY s.softwareId
GO
When I remove the NOT it displays all the softwareId rows that are in systemSoftware.
Problem is I want the opposite. The ones that are not in systemSoftware.
You need a left outer join:
I also changed the
ORDER BY, since it doesn’t make sense to order by a column that is not present.