should've been named CLEAVE smh
This commit is contained in:
parent
41868ff6c7
commit
a2f205fc4e
1 changed files with 22 additions and 7 deletions
|
@ -1,19 +1,34 @@
|
||||||
-- #### Start of class stuff ####
|
-- #### Start of class stuff ####
|
||||||
|
|
||||||
-- Get the InvoiceId, InvoiceTotal, and InvoiceDueDate for all invoices for vendor 110
|
-- Get the InvoiceID, InvoiceTotal, and InvoiceDueDate for all invoices for vendor 110
|
||||||
SELECT InvoiceId, InvoiceTotal, InvoiceDueDate
|
SELECT InvoiceID, InvoiceTotal, InvoiceDueDate
|
||||||
FROM Invoices
|
FROM Invoices
|
||||||
WHERE VendorID = 110
|
WHERE VendorID = 110
|
||||||
|
|
||||||
-- Get the latest 10 invoices for vendor 123: InvoiceId, InvoiceDueDate, InvoiceTotal
|
-- Get the latest 10 invoices for vendor 123: InvoiceID, InvoiceDueDate, InvoiceTotal
|
||||||
SELECT TOP 10 InvoiceId, InvoiceTotal, InvoiceDueDate
|
SELECT TOP 10 InvoiceID, InvoiceTotal, InvoiceDueDate
|
||||||
FROM Invoices
|
FROM Invoices
|
||||||
WHERE VendorID = 123
|
WHERE VendorID = 123
|
||||||
ORDER BY InvoiceDueDate DESC
|
ORDER BY InvoiceDueDate DESC
|
||||||
|
|
||||||
-- Get the InvoiceId, VendorId, InvoiceDueDate, and InvoiceTotal for all invoices due between 1/1/2020 and 1/31/2020
|
-- Get the InvoiceID, VendorID, InvoiceDueDate, and InvoiceTotal for all invoices due between 1/1/2020 and 1/31/2020
|
||||||
SELECT InvoiceId, VendorId, InvoiceDueDate, InvoiceTotal
|
SELECT InvoiceID, VendorID, InvoiceDueDate, InvoiceTotal
|
||||||
FROM Invoices
|
FROM Invoices
|
||||||
WHERE InvoiceDueDate BETWEEN '1/1/2020' AND '1/31/2020'
|
WHERE InvoiceDueDate BETWEEN '1/1/2020' AND '1/31/2020'
|
||||||
|
|
||||||
-- ######################################################################## --
|
-- ######################################################################## --
|
||||||
|
|
||||||
|
-- Get top 10 unpaid invoices
|
||||||
|
SELECT TOP 10 InvoiceID, VendorID, InvoiceTotal, InvoiceDueDate FROM Invoices
|
||||||
|
WHERE PaymentDate IS NULL
|
||||||
|
ORDER BY InvoiceDueDate
|
||||||
|
|
||||||
|
SELECT VendorID, VendorName, VendorContactLName, VendorContactFName FROM Vendors
|
||||||
|
WHERE VendorID IN (72, 83, 80, 123, 110, 106, 37) -- Output from last query
|
||||||
|
|
||||||
|
-- Combine them with JOIN
|
||||||
|
SELECT TOP 10 InvoiceID, Invoices.VendorID, InvoiceTotal, InvoiceDueDate, VendorName, VendorContactLName, VendorContactFName
|
||||||
|
FROM Invoices
|
||||||
|
JOIN Vendors ON Invoices.VendorID = Vendors.VendorID
|
||||||
|
WHERE PaymentDate IS NULL
|
||||||
|
ORDER BY InvoiceDueDate
|
Loading…
Reference in a new issue