How reterive duplicate value in SQL?
Answers were Sorted based on User's Feedback
Answer / justus
create table emp
empid empname
----- --------
101 a
102 b
103 a
104 c
105 a
select empname from emp group by empname having count(empname)>1
Is This Answer Correct ? | 12 Yes | 2 No |
Answer / sivasiva
create table emp
empid empname
----- --------
101 a
102 b
103 a
104 c
105 a
select empid from emp groupby empid,empname having count>1
Is This Answer Correct ? | 17 Yes | 12 No |
Answer / satishkulala
select empname from emp group by empname having count(empname)>1
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / rajesh.a
select count(*),empname from emp group by empname having count(*)>1
Is This Answer Correct ? | 4 Yes | 0 No |
create table emp (empid int,empname varchar)
insert into emp values (101,'a')
insert into emp values (102,'b')
insert into emp values (103,'a')
insert into emp values (104,'c')
insert into emp values (105,'a')
select * from emp
SELECT EmpName,Count(EmpID)Cnt From Emp Group By EmpName
Having Count(EmpName) > 1
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / ashish jain
create table emp
empid empname
----- --------
101 a
102 b
103 a
104 c
105 a
select empname from emp where count(empname)>1
Is This Answer Correct ? | 6 Yes | 10 No |
What's the maximum size of a row?
What are the different types of subquery?
What is filter index?
how to control the amount of free space in your index pages? : Sql server database administration
How to change location of errorlog in SQL?
How do I find query history in sql server?
Is port 1433 secure?
Explain activity monitors
You have modified 100 store procedures and want to replicate these changes from development to prodution, and production can have users using the Server/DB, how would you replicate without causing issues?
How optimize sql query with multiple joins in sql server?
What are recommended options to be used while using db mirroring? : sql server database administration
What is “begin trans”, “commit tran”, “rollback tran” and “savetran”?