Einzelnen Beitrag anzeigen

HeZa

Registriert seit: 4. Nov 2004
Ort: Dortmund
182 Beiträge
 
Delphi 10 Seattle Professional
 
#1

Interbase: Merkwürdiges Verhalten bei LEFT OUTER JOIN

  Alt 7. Apr 2020, 16:19
Datenbank: Interbase • Version: 2017 • Zugriff über: IBDAC
Hallo,

ich verliere gerade ein bisschen den Glauben daran das Interbase in Bezug auf LEFT OUTER JOIN korrekt arbeitet. Folgendes Script
Code:
create table test (id int);

insert into test (id) values (1);

select t1.id as id1, t2.id as id2, t3.id as id3 from
  test t1
  left outer join test t2 on t2.id = t1.id and t1.id = 1
  left outer join test t3 on t3.id = t1.id and t1.id = 1;

select t1.id as id1, t2.id as id2, t3.id as id3 from
  test t1
  left outer join test t2 on t2.id = t1.id and t1.id = 0
  left outer join test t3 on t3.id = t1.id and t1.id = 0;

select t1.id as id1, t2.id as id2, t3.id as id3 from
  test t1
  left outer join test t2 on t2.id = t1.id and t1.id = 1
  left outer join test t3 on t3.id = t1.id and t1.id = 0;

select t1.id as id1, t2.id as id2, t3.id as id3 from
  test t1
  left outer join test t2 on t2.id = t1.id and t1.id = 0
  left outer join test t3 on t3.id = t1.id and t1.id = 1;

drop table test;
Erwarten würde ich, dass mir die 4 SELECTs folgendes Ergebnis liefern:
Code:
SELECT ID1, ID2, ID3
   1    1    1    1
   2    1   NULL NULL
   3    1    1   NULL
   4    1   NULL  1
Das ist zu mindestens auch das was ich auf der Seite SQL Fiddle für jede angebotene Datenbank erhalte. Interbase 2017 liefert mir nun folgendes Ergebnis:
Code:
SELECT ID1, ID2, ID3
   1    1    1    1
   2      <no row>
   3      <no row>
   4    1   NULL  1
Was ist hier los? Wie sieht das bei Firebird aus (reines interesse)? Die Zugrffskomponenten sind raus, ich habe das mit IBExpert (IBDAC) und SQL Workbench /J (JAVA) geteste. Beides mal das gleiche Ergebnis. Auch wenn man 3 verschiedene Tabellen nimmt, ändert sich nichts.

Kann da einer Licht in diese dunkle Stunde bringen?

Ciao HeZa
  Mit Zitat antworten Zitat