CREATE VIEW `view_invoice_header` AS select `a`.`invoice_number` AS `invoice_number`, `a`.`project_id` AS `project_id`, `a`.`pos_id` AS `pos_id`, `a`.`invoice_date` AS `invoice_date`, `a`.`cashier` AS `cashier`, `a`.`paid` AS `paid`, `a`.`checkout` AS `checkout`, `a`.`printed` AS `printed`, `b`.`line_count` AS `line_count`, `b`.`total` AS `total`, `a`.`mdate` AS `mdate`, `a`.`cdate` AS `cdate` from ( `invoice_header` `a` left join `view_totals` as `b` on (`a`.`invoice_number` = `b`.`invoice_number`) );