Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

An alternative of DISTINCT

Ora_bieJan 29 2010 — edited Jan 29 2010
Hi Fellows,
I am in search of an alternative of DISTINCT keyword to improve the performance of my queries, and in that I need your help. While in this research I used ROWID to replace DISTINCT. But my query ,having ROWID, is not returning all the valid enteries. I do not know where exactly I'm going wrong.
/***********************************************************************************************************************************
--1.
SELECT DISTINCT tk.tadf_key FROM tasks tk WHERE tk.area_cd = 'MEPP';

--2.
SELECT t.tadf_key FROM tasks t WHERE rowid in (select min(rowid) from tasks tas where tas.tadf_key=t.tadf_key) and t.area_cd = 'MEPP';
***********************************************************************************************************************************/
In my DB, through first query I'm getting 24 rows, but with second query I am loosing some and getting 18 rows.

Could you help me out in finding the perfect query to get rid of DISTINCT and to increase the performance.

Thanks in advance,

Harbinder
This post has been answered by Frank Kulash on Jan 29 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 26 2010
Added on Jan 29 2010
3 comments
10,296 views