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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 find duplicate rows

Author  Topic 

x0x0
Starting Member

2 Posts

Posted - 2011-02-25 : 18:55:54
i
i have tried this query to remove duplicate values.

but getting error like 'incorrect syntax near keyword where"



select *
2 from
3 (select d.*
4 , count(*) over
5 (partition by empno) cnt
6 from dup_emp d
7 )
8 where cnt > 1;


what is wrong with this one?

how to find duplicate rows in a table on a field that is text?

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2011-02-26 : 00:07:02
Try this :
select *
from
(select d.*
, count(*) over
(partition by empno) cnt
from dup_emp d
) as subtab
where cnt > 1;
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-02-26 : 09:12:24
whenever you're creating derived table give it an alias

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -