같은 표 의 다 중 필드 를 조회 하 는 동시에 기 록 된 SQL 문 구 를 반복 합 니 다.
SQL
:7th string
( :peosons)
、 、 select p1.* from persons p1,persons p2 where p1.id<>p2.id and p1.cardid = p2.cardid and p1.pname = p2.pname and p1.address = p2.address
.
SQL
1. rowid
2. group by
3. distinct
1。 rowid
Oracle rowid , , , :
:
select * from table1 a where rowid !=(select max(rowid)
from table1 b where a.name1=b.name1 and a.name2=b.name2......)
:
delete from table1 a where rowid !=(select max(rowid)
from table1 b where a.name1=b.name1 and a.name2=b.name2......)
2.group by
:
select count(num), max(name) from student -- , name
group by num
having count(num) >1 -- num num ,
:
delete from student
group by num
having count(num) >1
。
3. distinct -
create table table_new as select distinct * from table1 minux
truncate table table1;
insert into table1 select * from table_new;
1、 , (peopleId)
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
2、 , (peopleId) , rowid
delete from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
and rowid not in (select min(rowid) from people group by peopleId having count(peopleId )>1)
3、 ( )
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
4、 ( ), rowid
delete from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)
5、 ( ), rowid
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)
( )
A “name”,
“name” ,
,“name” ;
Select Name,Count(*) From A Group By Name Having Count(*) > 1
:
Select Name,sex,Count(*) From A Group By Name,sex Having Count(*) > 1
( )
declare @max integer,@id integer
declare cur_rows cursor local for select ,count(*) from group by having count(*) >; 1
open cur_rows
fetch cur_rows into @id,@max
while @@fetch_status=0
begin
select @max = @max -1
set rowcount @max
delete from where = @id
fetch cur_rows into @id,@max
end
close cur_rows
set rowcount 0
" " , , , , Name , 。
1、 , ,
select distinct * from tableName
。
( 1 ),
select distinct * into #Tmp from tableName
drop table tableName
select * into tableName from #Tmp
drop table #Tmp
, 。
2、 ,
Name,Address,
select identity(int,1,1) as autoID, * into #Tmp from tableName
select min(autoID) as autoID into #Tmp2 from #Tmp group by Name,autoID
select * from #Tmp where autoID in(select autoID from #tmp2)
select Name,Address ( autoID , select )
( )
select * from tablename where id in (
select id from tablename
group by id
having count(id) > 1
)
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
activemq 5.5 의 입문 은 설치, 시작, 데이터베이스 지속 화 를 포함한다Apache ActiveMQ 5.5.0 은 주로 유지보수 버 전 으로 130 개가 넘 는 문 제 를 복 구 했 으 며 대부분 bug 와 개선 이 었 다. Improved performance for offline d...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.