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.

demo-queries-from slides-09.sql 328B

1234567891011
  1. SELECT vendor_name,
  2. (SELECT MAX(invoice_date) FROM invoices
  3. WHERE vendor_id = vendors.vendor_id) AS latest_inv
  4. FROM vendors
  5. ORDER BY latest_inv DESC;
  6. SELECT vendor_name, MAX(invoice_date) AS latest_inv
  7. FROM vendors v
  8. LEFT JOIN invoices i ON v.vendor_id = i.vendor_id
  9. GROUP BY vendor_name
  10. ORDER BY latest_inv DESC;