|
|
|
|
|
Re: New REPORT [message #646229 is a reply to message #646225] |
Tue, 22 December 2015 09:15 |
|
Danny Freeman
Messages: 21 Registered: December 2015 Location: UK
|
Junior Member |
|
|
OK very sorry.
I had written following query to produce the previous report which was client asking.In which I had to show the details in one single line. I mean subtotal which is sum of all the products. And Total which is sum of shipping plus subtotal. Now, client asking me to produce the output as shown in the attached csv file in which he still wants subtotal and total in single line but he doesn't want the grouping of names,email. I don't know how to write that code.
SELECT s_order_details.ordernumber,
Group_concat(s_order_details.name SEPARATOR '/'),
Group_concat(s_order_details.price SEPARATOR '/'),
s_order.currency,
Sum(s_order_details.quantity),
Sum(s_order_details.price * s_order_details.quantity),
Group_concat(s_order_details.articleordernumber SEPARATOR '/'),
s_order.invoice_shipping,
s_order.invoice_shipping
+ Sum(s_order_details.price),
Concat_ws(' ', s_order_shippingaddress.firstname, NULL,
s_order_shippingaddress.lastname),
s_order_shippingaddress.street,
s_order_shippingaddress.zipcode,
s_order_shippingaddress.city,
s_order_shippingaddress.company,
Concat_ws(' ', s_order_billingaddress.firstname, NULL,
s_order_billingaddress.lastname),
s_order_billingaddress.street,
s_order_billingaddress.zipcode,
s_order_billingaddress.city,
s_order_billingaddress.company,
s_order_billingaddress.phone
FROM s_order_details
INNER JOIN s_order_shippingaddress
ON s_order_details.orderid = s_order_shippingaddress.orderid
INNER JOIN s_order_billingaddress
ON s_order_details.orderid = s_order_billingaddress.orderid
INNER JOIN s_order
ON s_order.ordernumber = s_order_details.ordernumber
WHERE s_order_details.ordernumber = 20005
GROUP BY s_order_details.ordernumber
|
|
|
|