You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exercise-08.sql 379B

1234567891011121314
  1. SELECT vendor_name, invoice_number,
  2. invoice_date, invoice_total
  3. FROM invoices i
  4. JOIN
  5. (
  6. SELECT vendor_id, MIN(invoice_date) AS oldest_invoice_date
  7. FROM invoices
  8. GROUP BY vendor_id
  9. ) oi
  10. ON i.vendor_id = oi.vendor_id AND
  11. i.invoice_date = oi.oldest_invoice_date
  12. JOIN vendors v
  13. ON i.vendor_id = v.vendor_id
  14. ORDER BY vendor_name