With the christmas time at the door, its time to greet the customers
Is there a way to get a list of the customers together with a sum of their order values, preferrably sorted by their order values? Preferrably in oxid admin interface, but SQL statement would do it too.
SELECT oxfname, oxlname, oxstreet, oxstreetnr, oxzip, oxcity
FROM oxuser as a
JOIN
(
SELECT oxtotalbrutsum as summy, oxuserid as oxuserid
FROM oxorder as b
WHERE oxtotalordersum >= 50
group by oxuserid
) b ON a.oxid = b.oxuserid
SELECT oxfname, oxlname, oxstreet, oxstreetnr, oxzip, oxcity, c.oxtitle, summy
FROM oxuser as a
JOIN
(
SELECT oxtotalordersum as summy, oxuserid as oxuserid
FROM oxorder as b
WHERE oxtotalordersum >= 50
group by oxuserid
) b ON a.oxid = b.oxuserid
join oxcountry c on a.oxcountryid = c.oxid