Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » SQL




 Page 1 of 1 [ 4 posts ] 



Author Message
 Post subject: deletin the duplicate records 2.
 Post Posted: Sat Nov 21, 2009 2:07 pm 
Offline

Joined: Sat Feb 21, 2009 11:57 am
Posts: 40
I need to delete duplicate records wer all the fields are hte same

Code:
table: orderrebate
fields; ord_type
ord_no,
item_no,
line_seq_no,
cd_tp

_________________
Login: yes
Password: i dont have one
password is incorrect

Login: yes
Password: incorrect


Top 
 Post subject: Re: deletin the duplicate records 2.
 Post Posted: Sat Nov 21, 2009 2:07 pm 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=110167


Top 
 Post subject: Re: deletin the duplicate records 2.
 Post Posted: Sat Nov 21, 2009 2:07 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
Code:
DELETE f
FROM (
SELECT ROW_NUMBER() OVER (PARITION BY ord_type, ord_no, item_no, lin_seq_no ORDER BY cd_tp) AS RecID
) AS f
WHERE RecID > 1


Top 
 Post subject: Re: deletin the duplicate records 2.
 Post Posted: Sat Nov 21, 2009 2:08 pm 
Offline

Joined: Sat Feb 21, 2009 11:48 am
Posts: 22
Hi..
If all da values nd the fields n same in ur db than u just inlucde one
more column to ur table named ID or Sumthin Like dat n turn on da
identity for dat column so,,,,,dis field is diff. now u could easily
delete the records duplicate

_________________
A computer once beat me at chess, but it was no match for me at kick boxing.


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 4 posts ] 




Board index » Server Side Development » SQL


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron