CREATE VIEW `view_totals` AS

select 
	`a`.`invoice_number` AS `invoice_number`,
	count(`a`.`line_number`) AS `line_count`,
	sum(`a`.`price`) AS `total` 
from `invoice_details` a
group by `a`.`invoice_number`
