My data:
How can I get there? I tried to make a MySQL view on my table TAX.
CREATE VIEW TaxSplitPerOrder AS
SELECT
OrderNumber
, tax_invoiced
, total_invoiced
, created_at
, tax_percent
, SUM(tax_invoiced_order_item
)
FROM
test
GROUP by OrderNumber;
You need to include all of the other non-summarized columns from your SELECT
in the GROUP BY
clause. You may want to sum total_invoiced
too or else you will still have 2 rows for each order number.