Sum specific rows
-
Hello
I have a query where the columns “Ausfahrt”, “Kontoinhaber”, “Gesamtsumme”, “Vorname Teilnehmer”, “Order_ID” are queried. The data comes from the orders of the participants.
Now, in the query, I would like to summarize the rows as follows:
If the “Order_ID” is the same, the lines “Vorname Teilnehmer” should be combined in one line and separated by a “,” for example.
This is my code so far:
SELECT
zkzCrojUwoocommerce_order_items
.order_id
as 'Order_id' ,zkzCrojUwoocommerce_order_items
.order_item_name
as 'Order_item_name' ,zkzCrojUpostmeta
.meta_value
as 'Kontoinhaber' ,zkzCrojUpostmeta2
.meta_value
as 'Gesamtsumme' ,zkzCrojUwoocommerce_order_itemmeta
.meta_value
as 'Teilnehmer' FROMzkzCrojUpostmeta
INNER JOINzkzCrojUwoocommerce_order_items
ONzkzCrojUpostmeta
.post_id
=zkzCrojUwoocommerce_order_items
.order_id
INNER JOINzkzCrojUpostmeta
zkzCrojUpostmeta2 ONzkzCrojUpostmeta2
.post_id
=zkzCrojUpostmeta
.post_id
INNER JOINzkzCrojUwoocommerce_order_itemmeta
ONzkzCrojUwoocommerce_order_itemmeta
.order_item_id
=zkzCrojUwoocommerce_order_items
.order_item_id
WHERE (zkzCrojUpostmeta
.meta_key
= '_direct_debit_holder' ANDzkzCrojUpostmeta2
.meta_key
= '_order_total' ANDzkzCrojUwoocommerce_order_itemmeta
.meta_key
= 'vorname')Could you help me with my problem?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Sum specific rows’ is closed to new replies.