问题mysql代码:
SELECT COUNT(*) FROM ( SELECT cg.`moduleType`,cg.`moduleName` FROM t_category cg GROUP BY cg.`moduleType`,cg.`moduleName`) ;
执行之后报错:
1 queries executed, 0 success, 1 errors, 0 warnings
查询:select count(*) from ( select cg.`moduleType`,cg.`moduleName` from t_category cg group by cg.`moduleType`,cg.`moduleName`) LIMIT...
错误代码: 1248
Every derived table must have its own alias
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0 sec
错误解释:
像是这种多个表联合查询的时候派生出来的表就需要起个别名:
解决办法如下:
SELECT COUNT(*) FROM ( SELECT cg.`moduleType`,cg.`moduleName` FROM t_category cg GROUP BY cg.`moduleType`,cg.`moduleName`) a ;
起别名之后再执行则不会则报错