我想查找出一个表中某个字断不同的记录有多少条,用了下面的语句,不对
select count(distinct(id)) as total from table
不知道正确的应该怎么样写?
---------------------------------------------------------------
SELECT table.某个字段, Count() AS total
FROM table
GROUP BY table.某个字段;
---------------------------------------------------------------
上面只能返回有相同内容字段的记录数
正确的答案(经试验):
select count() as total from(select distinct(id) from table)