mysql 中使用group by分组时如何计总数
mysql中 使用group by时想计算出全部总数,而不是每个分组的总数时。sql这样写select count(1) from (select id from tabel group by colum ) count在后面一定要赋别名,这里用的count,要不然会有Every derived table must have its own alias报错
·
mysql中 使用group by时想计算出全部总数,而不是每个分组的总数时。
sql这样写
select count(1) from (select id from tabel group by colum ) count
在后面一定要赋别名,这里用的count,要不然会有Every derived table must have its own alias报错
更多推荐



所有评论(0)