一个简单的查询,应该查看systemSoftware
表格和软件表格,并只显示softwareId
不在systemSoftware
表格内的内容。
到目前为止,这是我的查询...
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
当我删除 NOT 时,它会softwareId
显示systemSoftware
.
问题是我想要相反的。那些不在systemSoftware
.