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!

Distinct left join

user624286Jun 19 2009 — edited Jun 19 2009
Hello,

I'm having a bit of head-block on this.

I have 2 tables a and b where a.id is in b 0, 1 or many times.

All I'm wondering is if there is a more efficient way of saying

SELECT DISTINCT a.*, b.a_id
FROM a
LEFT JOIN b ON b.a_id = a.id

given that a is really a complex sql statement on its own.

All I really want is a column which says whether a.id exists in b but which is the most efficient way of doing it,

Regards,

Iain
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2009
Added on Jun 19 2009
5 comments
3,836 views