0

Hi i have installed prestashop 1.4.8.2, i want report from mysql, Number of orders per customer with customer name & customer id plus i want total amount of order customer wise.

can you help me with SQL query so i can generate this report from phpmyadmin.

thanks,

regards,
Ritesh

3
Contributors
4
Replies
13
Views
3 Years
Discussion Span
Last Post by riteshuae
0

i have tried below code, but getting syntax error.

SELECT customers_firstname, customers_lastname,o.Number
FROM customers 
INNER JOIN (Select customer_id, count(*) as Number from orders Group by customer_id order by Number desc limit 5)AS o
on customers.customers_id = o.customer_id ;

#1064 - you have an error in your sql syntax (line number 5)

Edited by Dani: Formatting fixed

0

I am writing sample query

select a.id_customer, b.firstname,b.lastname, count(*) total_orders from orders a inner join customer b on a.id_customer=b.id_customer group by a.id_customer b.firstname,b.lastname
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.