Forum Moderators: open

Message Too Old, No Replies

Query Help

Left Outer Join ++

         

blend27

7:20 pm on Feb 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Need Help with the QUERY here.

What I am tying to do is pull the data from 3 table in SQL2000 DB
what I have is

tableA

tableA_id
tableA_id_tableB_id
tableA_str
tableA_txt
---------------------------------------
tableB

tableB_id
tableB_id_tableA_id
tableB_txt
----------------------------------------
tableC

tableC_id
tableC_Number_from
tableC_Number_to
----------------------------------------
functionA that converts tableA_str to integer
----------------------------------------
What I need is:

tableA_id.*
tableB_txt(if ANY where tableA_id_tableB_id = tableB_id_tableA_id)
tableC_id(if ANY where functionA(tableA_str) between tableC_Number_from and tableC_Number_to)

Thank for your help in advance

LifeinAsia

7:29 pm on Feb 16, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Is this what you are looking for?

SELECT tableA.tableA_id, tableB.tableB_txt, tableC.tableC_id
FROM tableA LEFT OUTER JOIN tableB ON tableA.id_tableB_id = tableB.id_tableA_id
LEFT OUTER JOIN tableC ON functionA(tableA.tableA_str) BETWEEN tableC.Number_from AND tableC.Number_to

[edited by: LifeinAsia at 7:29 pm (utc) on Feb. 16, 2007]

blend27

8:57 pm on Feb 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Perfect, thanks a lot