Home » SQL & PL/SQL » SQL & PL/SQL » Looping joins
Looping joins [message #614224] Mon, 19 May 2014 09:44 Go to next message
8511TPC
Messages: 2
Registered: May 2014
Junior Member
I was given a SQL code to work with and I noticed that the joins between the tables form a closed loop. I was always under the impression that this will return wrong results (less number of records).

select....
from A, B, C, A1 -- A1 is alias of A
where
A.col1=B.col1
and B.col2=C.col2
and C.col3=A1.Col3
and A1.Col1=A.Col1
and A1.Col2=B.Col2

Please let me know if this is correct.
Re: Looping joins [message #614225 is a reply to message #614224] Mon, 19 May 2014 09:51 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Please post your requirements properly, I am unable to understand what you need. Precicely, you need to post the desired output based on the input values. Elucidation required.

Only you know what those tables and joins mean. Only you know the desired output. We don't have the test case.
Re: Looping joins [message #614226 is a reply to message #614224] Mon, 19 May 2014 09:51 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Welcome to this forum


Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/


>Please let me know if this is correct.

SQL SELECT always gives correct result set, but you may be asking the wrong question.
Re: Looping joins [message #614227 is a reply to message #614226] Mon, 19 May 2014 09:59 Go to previous message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
BlackSwan wrote on Mon, 19 May 2014 20:21

SQL SELECT always gives correct result set, but you may be asking the wrong question.

IMPECCABLE!

[Updated on: Mon, 19 May 2014 09:59]

Report message to a moderator

Previous Topic: help with procedures!
Next Topic: How to add whitespace as default value using execute immediate?
Goto Forum:
  


Current Time: Thu Apr 25 16:46:08 CDT 2024