MYSQL 由结果集生成表

CREATE TABLE bc_temp_count1 AS
(
SELECT t1.uId AS 用户ID,t1.uName AS 用户名,COUNT(t3.tId) AS 任务个数,t4.uUsrAmount AS 总收入 FROM bc_User AS t1
LEFT JOIN bc_User_UpData AS t2 ON t1.uId=t2.upUserId
LEFT JOIN bc_Tasks AS t3 ON t2.tId=t3.tId
LEFT JOIN bc_User_Amount AS t4 ON t4.uId=t1.uId
WHERE t2.upSates=4 AND t3.tMode=3
GROUP BY t1.uId
ORDER BY 任务个数 DESC
LIMIT 1000
)



发表评论

电子邮件地址不会被公开。 必填项已用*标注

46 − = 44