我的表格如下:
ID PERSON UPDATE
1 132 1.1.2015
1 132 2.1.2015
3 152 4.5.2013
9 152 1.2.2013
我需要计算具有不同身份且大于1的人。
答案 0 :(得分:1)
我想你想要这个:
select person, count(distinct id)
from t
group by person
having count(distinct id) > 1;
答案 1 :(得分:0)
select person, count(*) from table
where id>1
group by person
或
select person, count(*) from table
where id<>1
group by person