myflashstore Posted March 14, 2010 Share Posted March 14, 2010 Hi, I'm trying to select the top 10 selling customers. I have 2 tables involves, a user table jos_users and an items table jos_mfs_items. This is the sql i'm using but it's not returning any results, i'm not sure if I am doing it right, can someone help? SELECT jos_users.*, COUNT(jos_mfs_items.*) FROM jos_users INNER JOIN jos_mfs_items ON jos_users.id = jos_mfs_items.producer WHERE jos_mfs_items.order_status = 1 GROUP BY jos_users.id ORDER BY COUNT(jos_mfs_items.*) DESC LIMIT 10 Link to comment https://forums.phpfreaks.com/topic/195185-query-help-for-selecting-top-selling-customers/ Share on other sites More sharing options...
fenway Posted March 19, 2010 Share Posted March 19, 2010 Re-write the query without the group by, and see if you're addressing the correct recordset. Link to comment https://forums.phpfreaks.com/topic/195185-query-help-for-selecting-top-selling-customers/#findComment-1028542 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.