¡¾×ªÌû¡¿SQL Oracleɾ³ýÖظ´¼Ç¼
1.Oracleɾ³ýÖظ´¼Ç¼.
ɾ³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨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)
ɾ³ý±íÖжàÓàµÄÖظ´¼Ç¼£¨¶à¸ö×ֶΣ©£¬Ö»ÁôÓÐ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)
================================
´Ë·½·¨¿ÉÒÔÊÊÓÃÓÚsql ,oracle
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
/*
DECLARE @count INT
SELECT @count = COUNT(*) from [table1] WHERE [column1] = 1
DELETE TOP (@count-1) from [table1] WHERE [column1] = 1 Õâ¸ötopºóÃæÒ»¶¨ÒªÓÐÀ¨ºÅ
*/
fetch cur_rows into @id,@max
end
close cur_rows
set rowcount 0
=======================================
select distinct * into #Tmp from tableName
drop table tableName
select * into tableName from #Tmp
drop table #Tmp
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 identity(int,1,1) as id ,name,state into #tempTable from a
delete from a
delete from #tempTable
where id not in
(
select min(id) from #tempTable group by name
)
insert into a( name,state)
select name,state from #tempTable
drop table #tempTable
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬³ö´¦£ºhttp://b
Ïà¹ØÎĵµ£º
"SQL Server °²×°³ÌÐòÎÞ·¨»ñÈ¡ ASPNET ÕÊ»§µÄϵͳÕÊ»§ÐÅÏ¢"
½â¾ö°ì·¨£º
ÓÃaspnet_regiisʵÓù¤¾ßжÔغÍÖØа²×°Ò»Ï¾ͿÉÒÔÁË¡£
¾ßÌåµÄ²Ù×÷£º
1¡¢½øÈëCMD£º
C:\windows\microsoft.net\framework\v2.0.50727Îļþ¼ÐÏ£¬ÔËÐÐaspnet_regiis -uжÔØ
È»ºóÔËÐÐaspnet_regiis -i ÖØа²×°£¬ÉÏÊöÎÊÌâ¼´¿É½â¾ö¡£
2¡¢C:\WINDOWS\ ......
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
Go
----½ØÈ¡×Ö·û´®£¬²¢³öÈ¥html
create FUNCTION [dbo].[CutString] (@str varchar(1000),@length int)
RETURNS varchar(1000) AS
BEGIN
declare @mainstr varchar(1000)
declare @substr varchar(1000)
if(@str is not null or @st ......
ÃæÏò OLTP Ó¦ÓóÌÐòµÄÖØÒª SQL Server 2005 ÐÔÄÜÎÊÌâ
OLTP ¹¤×÷¸ººÉµÄÌØÕ÷ÊÇ´æÔÚ´óÁ¿ÏàËƵÄСÐÍÊÂÎñ¡£
ÔÚ¼ì²éÊý¾Ý¿âÉè¼Æ¡¢×ÊÔ´ÀûÓúÍϵͳÐÔÄܵÄÖØÒªÐÔʱ£¬ÇëÎñ±ØÀμÇÕâЩÌØÕ÷¡£ÏÂÃæ¼òÊöÃæÏò OLTP
Ó¦ÓóÌÐòµÄÖØÒªÐÔÄÜÆ¿¾±»òȱÏÝ¡£
Êý¾Ý
¿âÉè¼ÆÎÊÌâ
³£Óòéѯ´æÔÚ¹ý¶àµÄ±íÁª½Ó¡£ÔÚ OLTP Ó¦ÓóÌÐòÖйý¶àʹÓÃÁª½Ó½«µ¼ ......
×÷Õß
£º
Takayuki Hoshino
׫¸åÈË
£º
Juergen Thomas
¼¼
Êõ
ÉóÔÄÈË
£º
Sanjay Mishra
SQL Server Ϊ SAP Ó¦ÓóÌÐòÌṩÁË׿ԽµÄÊý¾Ý¿âƽ̨¡£ÏÂÁн¨Òé¸ÅÊöÁËÕë¶Ô SAP ʵÏÖά»¤ SQL Server Êý¾Ý¿âµÄ×î¼Ñ×ö·¨¡£
ÿÌìÖ´ÐÐÍêÕûÊý¾Ý¿â±¸·Ý
´Ó
¼¼Êõ½Ç¶ÈÀ´Ëµ£¬Áª»ú±¸·Ý SAP Êý¾Ý¿â²»³ÉÎÊÌâ¡£ÕâÒâζ×Å£¬×îÖ ......
±ÈÈçÔÚNorthwindÊý¾Ý¿âÖÐ
ÓÐÒ»¸ö²éѯΪ
SELECT c.CustomerId, CompanyName
from Customers c
WHERE EXISTS(
SELECT OrderID from Orders o
WHERE o.CustomerID = cu.CustomerID)
ÕâÀïÃæµÄEXISTSÊÇÈçºÎÔË×÷ÄØ£¿×Ó²éѯ·µ»ØµÄÊÇOrderId×ֶΣ¬¿ÉÊÇÍâÃæµÄ²éѯҪÕÒµÄÊÇCustomerIDºÍCompanyName×ֶΣ¬ÕâÁ½¸ö×Ö¶Î¿Ï ......