表如下:
ID NAME
1 aa
1 bb
2 cc
我用
select * from table group by id having count(id)>1
结果是
id name
1 aa
怎么样才能出来结果
id name
1 aa
1 bb
我用mysql 5027
thanks.
ID NAME
1 aa
1 bb
2 cc
我用
select * from table group by id having count(id)>1
结果是
id name
1 aa
怎么样才能出来结果
id name
1 aa
1 bb
我用mysql 5027
thanks.
from 表 a
where exists(select 1 from 表 where id=a.id and name<>a.name);
where id in (select id from aa group by id having count(*)>1);
为什么MYSQL不支持我仍未应该支持的方法呢.