Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
berengar
Starting Member
21 Posts |
Posted - 2006-10-02 : 07:05:48
|
| Hi what do i need to add to this stmt to delete the result ?---------------select ct_cust1_text01,ct_address,ct_cust1_text09,count(*)from TABLE_NAME group by ct_cust1_text01,ct_address,ct_cust1_text09 having count(*) > 1---------i have tried delete * from TABLE_NAME where (select...)not great at SQL appreciate any help... |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-10-02 : 08:01:33
|
[code]delete dfrom TABLE_NAME d inner join ( select ct_cust1_text01, ct_address, ct_cust1_text09, count(*) as cnt from TABLE_NAME group by ct_cust1_text01,ct_address,ct_cust1_text09 having count(*) > 1 ) t ON d.ct_cust1_text01 = t.ct_cust1_text01 AND d.ct_address = t.ct_address AND d.ct_cust1_text09 = t.ct_cust1_text09[/code] KH |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-10-02 : 08:59:17
|
| Errmmm ... you're not trying to delete the duplicates and leave one record behind are you?Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|