mysql先排序后联合不成功问题解决方案
下面是按照天数,把每天分数分别排序
SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201116 ORDER BY score DESC limit 0, 1000) t1 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201115 ORDER BY score DESC limit 0, 1000) t2 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201114 ORDER BY score DESC limit 0, 1000) t3 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201113 ORDER BY score DESC limit 0, 1000) t4 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201112 ORDER BY score DESC limit 0, 1000) t5 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201111 ORDER BY score DESC limit 0, 1000) t6 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201110 ORDER BY score DESC limit 0, 1000) t7 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201109 ORDER BY score DESC limit 0, 1000) t8 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201108 ORDER BY score DESC limit 0, 1000) t9 UNION SELECT * FROM (SELECT * FROM baby_score_all WHERE `day`=20201107 ORDER BY score DESC limit 0, 1000) t10