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!

How to do a left cross join properly?

David BalažicApr 13 2011 — edited Apr 13 2011
Hi!

I have a SELECT using a cross join, like this:
SELECT DISTINCT A.* FROM A cross join B where this and that...
But I want results even in the case when table B has no rows.
So I do this:
SELECT DISTINCT A.* FROM A left join B on 1=1 where this and that...
This works, but the 1=1 part is bothering me. If I leave out the "on 1=1" part, I get an error "missing keyword".

Is there another syntax to express this?

Regards,
David
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 11 2011
Added on Apr 13 2011
6 comments
1,614 views