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-05.sql 419B

1234567891011
  1. SELECT account_description, COUNT(*) AS line_item_count,
  2. SUM(line_item_amount) AS line_item_amount_sum
  3. FROM general_ledger_accounts gl
  4. JOIN invoice_line_items li
  5. ON gl.account_number = li.account_number
  6. JOIN invoices i
  7. ON li.invoice_id = i.invoice_id
  8. WHERE invoice_date BETWEEN '2018-04-01' AND '2018-06-30'
  9. GROUP BY account_description
  10. HAVING line_item_count > 1
  11. ORDER BY line_item_amount_sum DESC