Write SQL Query 2

Exercise
Correct!
False!
Considering the database schema displayed in the SQLServer-style diagram below, write a SQL query to return a list of all the invoices. For each invoice, show the Invoice ID, the billing date, the customer’s name, and the name of the customer who referred that customer (if any). The list should be ordered by billing date.

Return Invoices that do not have an associated Customer.
SELECT i.Id, i.BillingDate, c.Name, r.Name AS ReferredByName FROM Invoices i code_here Customers c ON i.CustomerId = c.Id code_here Customers r ON c.ReferredBy = r.Id ORDER BY i.BillingDate

results matching ""

    No results matching ""