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.

exer_5C28.sql 323B

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