I am writing a request for a sample of TOP-10 buyers. I could easily bring out buyers for all the time, but there was a question about sorting by date. I recorded the request in this way, everything is executed, but the UNIX sorting of the o.date column does not occur. Request:
SELECT o.user_id, SUM(o.total_price) as nsum, o.date as odate, u.id as uid, u.balance as balance, u.name as login FROM s_orders as o,s_users as u WHERE user_id!='NULL' AND o.user_id=u.id AND o.date >= UNIX_TIMESTAMP(DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) GROUP BY user_id ORDER BY nsum DESC LIMIT 10
o.date? Can meant that conditionWHEREnot fulfilled? - Anatol