Kundenranking (Harlinghausen)

Anfangsmonat wählen
Endmonat wählen
 
SELECT cu.customer_name, cu.customer_nr, COUNT(c.au) AS orders, SUM(a.quantity) as quantity, SUM(c.costs) as costs, SUM(c.material) as material, (SUM(c.sales) - SUM(c.credit) - SUM(c.discount)) as sales, SUM(c.result) as result FROM h_calculation c JOIN h_amount a ON c.au = a.au JOIN h_customer cu ON c.au = cu.au WHERE cu.au != '' AND c.month BETWEEN '' AND '' GROUP BY cu.customer_nr ORDER BY (SUM(c.sales) - SUM(c.credit) - SUM(c.discount)) DESC
#KundeAufträgeMengeSelbstkostenRohertragErlösErgebnis