In: Computer Science
In sql: Write a query to produce a listing of unique vendor names who have at least one invoice with us. You are using a table view called COMPANY_INFORMATION that lists a vendor id, vendor name, term id, and term description. The second table you will reference is the invoice table that lists vendor id, invoice num, invoice number, and invoice total. Do not show duplicate results.
Use Following query to produce a listing of unique vendor names who have at least one invoice with us.
SELECT DISTINCT vendorName FROM COMPANY_INFORMATION ci JOIN Invoice i ON ci.vendorId = i.vendorId;
We can join table using vendorId and for unique names use DISTINCT keyword.