raghugnair Posted March 9, 2012 Share Posted March 9, 2012 Hi all, I want to find duplicate records from a joint table result (The two tables are from two different DB's). Bellow are the tables and my requirement. Table1 from DB D1EmpID205205205206207207208209210211 Table2 from DB D2PayID205206207 208 209 210 211 i have joined these two tables on the basis of EmpID = PAYID and got the following result SELECT T1.EMPID,T2.PAYIDFROM D1.table1 T1INNERJOIN D2.table2 T2 onT1.EMPID collate Latin1_General_CI_AI =T2.PayID EmpID PayID 205 205 205 205 205 205206 206207 207207 207208 208209 209210 210211 211 In this result 205 and 207 having duplicate, so i want a query to display the duplicate entries . Link to comment Share on other sites More sharing options...
justsomeguy Posted March 9, 2012 Share Posted March 9, 2012 The duplicates are in the first table only. https://www.google.com/search?client=opera&rls=en&q=sql+query+to+find+duplicate+rows&sourceid=opera&ie=utf-8&oe=utf-8&channel=suggest Link to comment Share on other sites More sharing options...
raghugnair Posted March 10, 2012 Author Share Posted March 10, 2012 The duplicates are in the first table only. https://www.google.c...channel=suggest txs for the reply, i know how to find the duplicate from one table. what i want is, to display the duplicate records from a join table result. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 12, 2012 Share Posted March 12, 2012 You can treat a joined table like a regular table. Give the join an alias and you can refer to that in other operations. SELECT * FROM (SELECT * FROM table1 INNER JOIN table2) AS temp Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.