How I get Join association? [message #18021] |
Wed, 28 June 2006 15:13  |
Eclipse User |
|
|
|
Originally posted by: clodoaldo.phoebus.com.br
Hi all,
I'm using SQLParser and I have the problem. When the query exists more than one join clause occurred some problem. For example:
SELECT t1.c1 , t2.c2, t3.c3 FROM TABLE1 t1 LEFT JOIN TABLE2 t2 ON t1.c1 = t2.c2 RIGHT JOIN TABLE3 t3 ON t3.c3 = t2.c2
For first join i get the TableRefLeft (= TABLE1) and TableRefRight(= TABLE2) but I do not obtain TableRefLeft for second join (return null).
Exists another form for this intention?
[]'s clodoaldo
|
|
|
Re: How I get Join association? [message #18035 is a reply to message #18021] |
Wed, 28 June 2006 18:17  |
Eclipse User |
|
|
|
clodoaldo,
The join expression parses like this:
((TABLE1 t1 LEFT JOIN TABLE2 t2 ON t1.c1 = t2.c2) RIGHT JOIN TABLE3 t3 ON t3.c3 = t2.c2)
Which produces this structure:
TableJoined(1)
/ \
TableJoined(2) T3
/ \
T1 T2
To get T3 you need to get the TableRefRight of TableJoined(1).
TableJoined(1) is the TableReference contained in the fromClause list of
the QuerySelect.
Brian Payton
SQL Tools Development
IBM Silicon Valley Lab
clodoaldo wrote:
> Hi all,
>
> I'm using SQLParser and I have the problem. When the query exists more than one join clause occurred some problem. For example:
> SELECT t1.c1 , t2.c2, t3.c3 FROM TABLE1 t1 LEFT JOIN TABLE2 t2 ON t1.c1 = t2.c2 RIGHT JOIN TABLE3 t3 ON t3.c3 = t2.c2
>
> For first join i get the TableRefLeft (= TABLE1) and TableRefRight(= TABLE2) but I do not obtain TableRefLeft for second join (return null).
>
> Exists another form for this intention?
>
> []'s clodoaldo
>
|
|
|
Re: How I get Join association? [message #580253 is a reply to message #18021] |
Wed, 28 June 2006 18:17  |
Eclipse User |
|
|
|
clodoaldo,
The join expression parses like this:
((TABLE1 t1 LEFT JOIN TABLE2 t2 ON t1.c1 = t2.c2) RIGHT JOIN TABLE3 t3 ON t3.c3 = t2.c2)
Which produces this structure:
TableJoined(1)
/ \
TableJoined(2) T3
/ \
T1 T2
To get T3 you need to get the TableRefRight of TableJoined(1).
TableJoined(1) is the TableReference contained in the fromClause list of
the QuerySelect.
Brian Payton
SQL Tools Development
IBM Silicon Valley Lab
clodoaldo wrote:
> Hi all,
>
> I'm using SQLParser and I have the problem. When the query exists more than one join clause occurred some problem. For example:
> SELECT t1.c1 , t2.c2, t3.c3 FROM TABLE1 t1 LEFT JOIN TABLE2 t2 ON t1.c1 = t2.c2 RIGHT JOIN TABLE3 t3 ON t3.c3 = t2.c2
>
> For first join i get the TableRefLeft (= TABLE1) and TableRefRight(= TABLE2) but I do not obtain TableRefLeft for second join (return null).
>
> Exists another form for this intention?
>
> []'s clodoaldo
>
|
|
|
Powered by
FUDForum. Page generated in 0.02703 seconds