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-10.sql 321B

1234567891011
  1. SELECT vendor_state, MAX(sum_of_invoices) AS max_sum_of_invoices
  2. FROM
  3. (
  4. SELECT vendor_state, vendor_name,
  5. SUM(invoice_total) AS sum_of_invoices
  6. FROM vendors v JOIN invoices i
  7. ON v.vendor_id = i.vendor_id
  8. GROUP BY vendor_state, vendor_name
  9. ) t
  10. GROUP BY vendor_state
  11. ORDER BY vendor_state;