Hello friends,
I have a one problem, i have a table in that some reocrds are duplicate.i want to find which records are duplicate.
for exp. my table is as follows
emp_id emp_name
1 aa
2 bb
3 cc
1 aa
3 cc
3 cc
and i want the result is like
emp_id emp_name
1 aa
1 aa
3 cc
3 cc
3 cc
SELECT Emp_Id, Emp_Name
FROM myTable
GROUP BY Emp_ID, EMP_Name
HAVING COUNT(*) > 1
Read up books online about GROUP BY and HAVING clause.
|||SELECT *
FROM emp
GROUP BY emp_id,emp_name
HAVING COUNT(*) > 1
Thank u
Baba
Please remember to click "Mark as Answer" on this post if it helped you.
|||Thanks ndinakar &baba
but i want the repeated rows should be shown in the result.
like
emp_id emp_name
1 aa
1 aa
3 cc
3 cc
3 cc
not
emp_id emp_name
1 aa
3 cc
|||
Use order by clause
Select * from emp order by eno desc
Thank u
Baba
Please remember to click "Mark as Answer" on this post if it helped you.
|||
Select *from MyTable Tjoin (SELECT Emp_Id, Emp_NameFROM MyTableGROUP BY Emp_ID, EMP_NameHAVINGCOUNT(*) > 1) Aon a.emp_id = T.emp_idand A.emp_name = T.emp_name|||
Thanks, Ndinkar..
this is i want..
No comments:
Post a Comment