I am trying to write a gross Profit Report with the following info on it Date, Order#, Customer Name, Gross Amt, Sales Tax, Freight, Discount, Cost of goods sold, and Net Amt.. My problem is that my cost of goods sold is spread across several lines as it is attached to each item. What I am looking to do is add all lines of "cost of goods sold" where the invoice numbers are the same. Each line does contain the invoice number.
Table invoice_line
columns invoice_no line COGS_amount
806712 1 12.50
806712 2 7.85
806712 3 5.65
806941 1 100.80
806927 1 53.00
806927 2 14.95
I would like each invoice to have one line on my report so I need to total COGS for each invoice.
Table invoice_line
columns invoice_no line COGS_amount
806712 1 12.50
806712 2 7.85
806712 3 5.65
806941 1 100.80
806927 1 53.00
806927 2 14.95
I would like each invoice to have one line on my report so I need to total COGS for each invoice.