select
a.
*
from
表 a
where
(
select
count
(
*
)
from
表
where
字段
=
a.字段)
>
1
select * from 表 where 字段 in ( select 字段 from 表 group by 字段 having count ( 1 ) > 1 )
-- 如果不能通过一个字段确定一行的话,可以把多个字段都转换成字符型串起来
select * from 表 where convert ( varchar ( 100 ),字段1) + convert ( varchar ( 100 ),字段2) in ( select convert ( varchar ( 100 ),字段1) + convert ( varchar ( 100 ),字段2) from 表 group by convert ( varchar ( 100 ),字段1) + convert ( varchar ( 100 ),字段2) having count ( 1 ) > 1 )
select 字段1,字段2,字段3,字段4...(所有字段)
from t1
group by 字段1,字段2,字段3,字段4...(所有字段)
having count ( * ) > 1
select * from 表 t
where ( select count ( 1 )
from 表
where 字段1 = t.字段1
and 字段2 = t.字段2
and 字段3 = t.字段3
.............
) > 1
select PermissionString
from roleadmin
where roleid in ( 1 , 3 )
group by PermissionString
having count ( distinct roleid) = 2
select * from 表 where 字段 in ( select 字段 from 表 group by 字段 having count ( 1 ) > 1 )
-- 如果不能通过一个字段确定一行的话,可以把多个字段都转换成字符型串起来
select * from 表 where convert ( varchar ( 100 ),字段1) + convert ( varchar ( 100 ),字段2) in ( select convert ( varchar ( 100 ),字段1) + convert ( varchar ( 100 ),字段2) from 表 group by convert ( varchar ( 100 ),字段1) + convert ( varchar ( 100 ),字段2) having count ( 1 ) > 1 )
select 字段1,字段2,字段3,字段4...(所有字段)
from t1
group by 字段1,字段2,字段3,字段4...(所有字段)
having count ( * ) > 1
select * from 表 t
where ( select count ( 1 )
from 表
where 字段1 = t.字段1
and 字段2 = t.字段2
and 字段3 = t.字段3
.............
) > 1
select PermissionString
from roleadmin
where roleid in ( 1 , 3 )
group by PermissionString
having count ( distinct roleid) = 2