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-6.sql 422B

1234567891011
  1. SELECT vendor_name, invoice_number, invoice_date,
  2. line_item_amount, account_description
  3. FROM vendors v
  4. JOIN invoices i
  5. ON v.vendor_id = i.vendor_id
  6. JOIN invoice_line_items li
  7. ON i.invoice_id = li.invoice_id
  8. JOIN general_ledger_accounts gl
  9. ON li.account_number = gl.account_number
  10. WHERE invoice_total - payment_total - credit_total > 0
  11. ORDER BY vendor_name, line_item_amount DESC;