关于SQL语句

[复制链接]
查看11 | 回复3 | 2012-7-20 12:40:27 | 显示全部楼层 |阅读模式
select name,count(*) from persongroup by namehaving count(*)>1
delete from personwhere id inselect distinct a.id From person a,(select * From person where name in(select name from persongroup by namehaving count(*)>1 )) bwhere a.name=b.name and a.id>b.id...
回复

使用道具 举报

千问 | 2012-7-20 12:40:27 | 显示全部楼层
mysql写法1、select a.* from person a where a.name in (select b.name from person b group by b.name having count(1) > 1);第二个一条语句实现还没想出来...
回复

使用道具 举报

千问 | 2012-7-20 12:40:27 | 显示全部楼层
select id,t1.name,age, t2.times from test t1 inner join (select name,COUNT(*)as times from testgroup by name having COUNT(*)>1)t2 on t1.name=t2.name...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行