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.

1234567891011121314151617
  1. SELECT
  2. vendor_name,
  3. i.invoice_id,
  4. invoice_sequence,
  5. line_item_amount
  6. FROM
  7. invoices i JOIN vendors v
  8. ON v.vendor_id = i.vendor_id
  9. JOIN invoice_line_items li
  10. ON i.invoice_id = li.invoice_id
  11. WHERE i.invoice_id IN (SELECT DISTINCT invoice_id
  12. FROM invoice_line_items
  13. WHERE invoice_sequence > 1)
  14. ORDER BY vendor_name, invoice_id, invoice_sequence;