SELECT VendorName, COUNT(*) as Total_Invoices
FROM Invoices JOIN Vendors ON Invoices.VendorID = Vendors.VendorID
WHERE Vendors.VendorName = 'IBM'
GROUP BY VendorName
ORDER BY Total_Invoices DESC
它会带来
VendorName Total_Invoices
IBM 2
我想做,所以它只是说
Total_Invoices
2
未显示 IBM VendorName 但仍计算 IBM 的总发票