“请提供我们用于任何类型设计工作的供应商列表,并显示与它们处于相同状态的所有其他供应商。”
我试图过滤它,即使类别不正确,CA州的每个人都应该出现在这里。应该有75个,但我仍然只有3个。我使用的是我认为会触发它的不存在。有什么建议吗?
SELECT
InvoiceLineItemDescription AS ITEMNAME,
VendorState
FROM InvoiceLineItems
JOIN Invoices
ON Invoices.InvoiceID = InvoiceLineItems.InvoiceID
JOIN Vendors
ON invoices.VendorID = Vendors.VendorID
WHERE InvoiceLineItemDescription = 'cover design'
OR NOT EXISTS (SELECT
InvoiceLineItemDescription
FROM InvoiceLineItems ili
JOIN invoices i
ON i.InvoiceID = ili.InvoiceID
JOIN Vendors v
ON i.VendorID =
v.VendorID
WHERE VendorState = 'Ca')
Invoices Table:
VendorID | InvoiceNumber | InvoiceDate | InvoiceTotal | PaymentTotal | CreditTotal |
TermsID | InvoiceDueDate | PaymentDate | ________________| ________________
Vendors table VendorID | VendorName | VendorAdress1 | VendorAdress2 | VendorCity |
VendorState | VendorZipCode | VendorPhone |__ VendorContactLName | VendorContactFName
| DefaultTermsID | DefaultAccountNo |
InvoiceLineItems | InvoiceID | InvoiceSequence | AccountNO | InvoiceLineItemAmount |
InvoiceLineItemDescription |