Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » How I get Join association?
How I get Join association? [message #18021] Wed, 28 June 2006 19:13 Go to next message
Eclipse UserFriend
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 22:17 Go to previous message
Brian Payton is currently offline Brian PaytonFriend
Messages: 152
Registered: July 2009
Senior Member
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 22:17 Go to previous message
Brian Payton is currently offline Brian PaytonFriend
Messages: 152
Registered: July 2009
Senior Member
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
>
Previous Topic:How I get Join association?
Next Topic:New Data Set - Incomplete database results
Goto Forum:
  


Current Time: Thu Dec 18 22:32:32 GMT 2014

Powered by FUDForum. Page generated in 0.02217 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software