I'm doing some testing to convert from an ancient version of SQLA to v17 and I'm running into many datawindows that no longer function.
The problem seems to be related to Outer Joins. Here's a demo of the problem:
create table test1 (ukey integer not null default autoincrement primary key, SomeName char(30), Addr1 char(40), Addr2 char(40));
create table test2 (ukey integer not null default autoincrement primary key, Link1 integer, Data1 integer, Data2 integer, Data3 integer);
create table test3 (ukey integer not null default autoincrement primary key, Link1 integer, Data1 integer, Data2 integer, Data3 integer);
select test1.*, test2.data1, test3.data2
from test1,
test2
left outer join test3 on test3.link1=test1.ukey and test3.link1=test2.ukey;
Left outer join on clause fails to find Test1. If you flip Test1 and Test2 in the from clause, it will fail to find Test2 instead. Aliases don't help either. Why can't you refer to more than one other table in a join clause? Why would this work in an older version of SQLA and not now?
We have Developer SQLA17. I want to patch to current to test, but I have been unable to find anyone at SAP that can tell me how to get patches for developer SQLA17 so we can see if the problem has been fixed. We're in a catch-22 here - we won't buy without patching to test, and can't patch because we haven't bought it yet.
Does anyone have a clue as to what's wrong with this query? (demo is over-simplified, but a where/on clause referring to multiple other tables does not seem unusual to me) Or, if nothing is actually wrong, has it been fixed in a patch? We have dozens of datawindows that work this way, so a workaround isn't really an option here.
Request clarification before answering.
Looks like a precedence issue. Did you try to put brackets around (test1, test2)? If the left outer join has precedence over the "other" join (which is a cross join, btw), I'd expect this issue. I don't think its wise to mix the two join notations in a single statement anyway unless to confuse the Russians.
Would
select test1.*, test2.data1, test3.data2 from (test1 join test2 on test1.ukey = test2.ukey) left outer join test3 on test3.link1=test1.ukey and test3.link1=test2.ukey
do the job and produce the correct / desired result?
HTH
Volker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.