view_invoices.sql 539 B

12345678910111213141516171819
  1. CREATE VIEW `view_invoices` AS
  2. select
  3. `a`.`invoice_number` AS `invoice_number`,
  4. `a`.`project_id` AS `project_id`,
  5. `a`.`pos_id` AS `pos_id`,
  6. `a`.`invoice_date` AS `invoice_date`,
  7. `a`.`cashier` AS `cashier`,
  8. `a`.`line_count` AS `line_count`,
  9. `a`.`total` AS `total`,
  10. `b`.`line_number` AS `line_number`,
  11. `b`.`item` AS `item`,
  12. `b`.`seller_id` AS `seller_id`,
  13. `b`.`item_id` AS `item_id`,
  14. `b`.`price` AS `price`
  15. from (
  16. `view_invoice_header` `a`
  17. left join `invoice_details` `b` on (`a`.`invoice_number` = `b`.`invoice_number`)
  18. );