1 2 3 4 5 6 7 8 9 10
delimiter // create procedure get_invoice_price_info(i_invoice_id INT) begin select sum(ii_amount * ii_price) as bruto_price from invoices inner join invoice_items on ii_invoiceid = i_id and i_id = i_invoice_id; end // delimiter ;