![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am trying to do a join in an SPL routine and it is not returning what I am wanting so any help is appreciated: Informix 9.4FC3 on HPUX I have a view created that joins 3 tables and that returns a 27k row view. Within my SPL, I want to join this view to 3 tables, ensuring I get a row when any of the 3 tables meets a criteria (but all 3 may not). I have it currently as "... FROM view, OUTER tab1, OUTER tab2, OUTER tab3 WHERE v.1 = tab1.1 and v.2 = tab1.2 and v.1 = tab2.1 and v.2 = tab2.2 etc". But instead of getting a row from View when any of the 3 tables has a match, I get EVERY row from view and it dupes tab1,2,3 info to fit. It is my understanding that if I use an inner join, if any of the 3 tables doesn't have a matching row, the entire row won't be returned and that is what I am trying to avoid. Example: View rows: 1 a some value 1 b some value 2 a some value ... 55 z some value tab1, tab2, and tab3 have identical columns: 1 a data 1 b data 2 c data ... I need the return from my SPL to be view field1, view field2, tab1 field 3, tab2 field 3, tab3 field 3, calculated field of (tab1-tab2-tab3 field3's), some more columns. I want to ensure that I will get the row even if tab1 2 OR 3 doesn't have a matching row (I use NVL(field,0) so arithmetic still works). What I end up getting is every view rows data and tab 1,2, & 3 rows repeated even though there are NO match in any of the 3 tables. What do I need to do to ensure getting every row I need, but not get erroneous duplicates? TIA, Randy K. ** |
#3
| |||
| |||
|
|
I am trying to do a join in an SPL routine and it is not returning what I am wanting so any help is appreciated: Informix 9.4FC3 on HPUX I have a view created that joins 3 tables and that returns a 27k row view. Within my SPL, I want to join this view to 3 tables, ensuring I get a row when any of the 3 tables meets a criteria (but all 3 may not). I have it currently as "... FROM view, OUTER tab1, OUTER tab2, OUTER tab3 WHERE v.1 = tab1.1 and v.2 = tab1.2 and v.1 = tab2.1 and v.2 = tab2.2 etc". But instead of getting a row from View when any of the 3 tables has a match, I get EVERY row from view and it dupes tab1,2,3 info to fit. It is my understanding that if I use an inner join, if any of the 3 tables doesn't have a matching row, the entire row won't be returned and that is what I am trying to avoid. Example: View rows: 1 a some value 1 b some value 2 a some value ... 55 z some value tab1, tab2, and tab3 have identical columns: 1 a data 1 b data 2 c data ... I need the return from my SPL to be view field1, view field2, tab1 field 3, tab2 field 3, tab3 field 3, calculated field of (tab1-tab2-tab3 field3's), some more columns. I want to ensure that I will get the row even if tab1 2 OR 3 doesn't have a matching row (I use NVL(field,0) so arithmetic still works). What I end up getting is every view rows data and tab 1,2, & 3 rows repeated even though there are NO match in any of the 3 tables. What do I need to do to ensure getting every row I need, but not get erroneous duplicates? |
|
Within my SPL, I want to join this view to 3 tables, ensuring I get a row when any of the 3 tables meets a criteria (but all 3 may not). |
#4
| |||
| |||
|
|
I am trying to do a join in an SPL routine and it is not returning what I am wanting so any help is appreciated: Informix 9.4FC3 on HPUX I have a view created that joins 3 tables and that returns a 27k row view. Within my SPL, I want to join this view to 3 tables, ensuring I get a row when any of the 3 tables meets a criteria (but all 3 may not). I have it currently as "... FROM view, OUTER tab1, OUTER tab2, OUTER tab3 WHERE v.1 = tab1.1 and v.2 = tab1.2 and v.1 = tab2.1 and v.2 = tab2.2 etc". But instead of getting a row from View when any of the 3 tables has a match, I get EVERY row from view and it dupes tab1,2,3 info to fit. It is my understanding that if I use an inner join, if any of the 3 tables doesn't have a matching row, the entire row won't be returned and that is what I am trying to avoid. Example: View rows: 1 a some value 1 b some value 2 a some value ... 55 z some value tab1, tab2, and tab3 have identical columns: 1 a data 1 b data 2 c data ... I need the return from my SPL to be view field1, view field2, tab1 field 3, tab2 field 3, tab3 field 3, calculated field of (tab1-tab2-tab3 field3's), some more columns. I want to ensure that I will get the row even if tab1 2 OR 3 doesn't have a matching row (I use NVL(field,0) so arithmetic still works). What I end up getting is every view rows data and tab 1,2, & 3 rows repeated even though there are NO match in any of the 3 tables. What do I need to do to ensure getting every row I need, but not get erroneous duplicates? |
|
TIA, Randy K. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |