mysql 分组统计,值在前,条件在后
-- 分组统计,值在前,条件在后, SELECT DATE_FORMAT(del_time,"%Y") as ndate ,DATE_FORMAT(del_time,"%m") as ndate2 ,DATE_FORMAT(del_time,"%d") as ndate3 , sum(weight)as money from delivery GROUP BY ndate, ndate2,ndate3 WHERE 1 -- 以下自定义条件 user_id ="test_user_id" -- `door1`, `door2`, `door3`, `door4`, -- `user_id`, `type` -- `dev_id`, `org_id`, `recovery`