This content has been marked as final. Show 3 replies
What's wrong with SELECT DISTINCT?
At any rate, GROUP BY gets distinct values:
Note that there's no need to use tab_b to get these resutls. "FROM tab_a LEFT OUTER JOIN tab_b" means you want all the rows from tab_a, regardless of whether or not they have a match in tab_b. Since you're not interested in any data from tab_b, and you specifically don't want any replication of rows that might be caused by 2 or more rows in tab_b matching the same row in tab_a, then you'll get the same results with or without the outer join.
SELECT ename FROM tab_a GROUP BY ename ;
No you can't, to avoid using distinct clause, you can opt for group by.
if there are duplicates in TAB_A, you'll get 'em in any join for the same column on TAB_B
you can a)remove the duplicates in TAB_A, b) use a DISTINCT c) GROUP BY or d) a UNION of TAB_A with itself -
have to say , DISTINCT looks fine to me