Inner Join on multiple tables

Inner Join multiple tables

Reference:

Inner Join means that only rows with matching data in the joined tables will be returned. So if you had an invoices, vendors, and invoicelineitem table set, and you queried it using inner join, you would only get back those rows where your select fields had matching data. An example of the sql using the above scenario is:

 select VendorName, i.InvoiceID, InvoiceNumber, InvoiceDate, InvoiceTotal, InvoiceLineItemAmount
from Vendors v
    INNER JOIN Invoices i
        ON v.VendorID = i.VendorID
    INNER JOIN InvoiceLineItems ili
        ON i.invoiceid = ili.InvoiceID
Where
    InvoiceTotal >= 500
Order By
    VendorName, InvoiceTotal desc


 

 
Maint