RE: how can we avoid duplicate rows. without using dis...
it is working fine........what is the problem.......please describe .......... select a.* b.* from emp a emp b where a.deptno b.deptno and a.rowid<>b.rowid
RE: how can we avoid duplicate rows. without using dis...
this code is not working to avoid dup. records. when ever we use 1) a.deptno b.deptno and 2)a.rowid<>b.rowid then oracle satisfies both conditions due to and operator. in emp table suppose take 10 as deptno(which is having 3 times in that table) according to this coding 1)condition satisfies ie both tables having same deptno 2)condition satisfies so that record will not be retrived. so it is satisfied for one record with deptno as 10. what about the remaining two records having deptno as 10. the 2)condition will not satisfies for these two records thats why these records retrived . (these r duplicate records)
RE: how can we avoid duplicate rows. without using dis...
This query will return the first row for each unique id in the table. This query could be used as part of a delete statement to remove duplicates if needed.
SELECT ID
FROM func t1
WHERE ROWID (SELECT MIN (ROWID)
FROM func WHERE ID t1.ID)
Also: You can use a group by without a summary function SELECT ID
RE: how can we avoid duplicate rows. without using dis...
Hi I think this is not the right query for getting unique values of a column from a table. Like a table EMP contains the column like DEPTNO having duplicate values.
For getting unique values of DEPTNO query will be like this:
< select a.DEPTNO from emp a emp b where a.deptno b.deptno and a.rowid not in (select max(rowid) from emp) group by a.deptno; >