Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: BLR syntax error: expected derived relation expression at offset 108



Permlink Replies: 0
Joachim Breuer

Posts: 14
Registered: 4/10/03
BLR syntax error: expected derived relation expression at offset 108
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 8, 2017 3:02 AM
Hello,

this SQL statement is from an Advantage Database Server. IBConsole with Interbase 2017 give me this error.

Error at line 1
invalid request BLR at offset 108
BLR syntax error: expected derived relation expression at offset 108, encountered 1
SQL - select *
from Kunde as Kunde
left join (select ksKundenNr,ksDatum,ksNettoBetrag,ksNettoADS,ksRabatt,ksLastschrift,ksZahlungsperiode,ksBemerkung
from (
select MAX(ksDatum) as nwDatum, ksKundenNr as nwKundenNr
from KundeStaffel
where ksDatum <= '08.11.2017'
group by ksKundenNr) as Temp
left join KundeStaffel
on (nwDatum=ksDatum) and (nwKundenNr=ksKundenNr)
) as Staffeln on Kunde.kuID=Staffeln.ksKundenNr

The table structure is:

CREATE TABLE "KUNDE"
(
"KUID" INTEGER,
"KUKURZNAME" VARCHAR(32) COLLATE DE_DE,
"KUFIRMA1" VARCHAR(64) COLLATE DE_DE,
"KUFIRMA2" VARCHAR(64) COLLATE DE_DE,
"KUSTRASSE" VARCHAR(64) COLLATE DE_DE,
"KULKZ" VARCHAR(3) COLLATE DE_DE,
"KUPLZ" VARCHAR(5) COLLATE DE_DE,
"KUORT" VARCHAR(64) COLLATE DE_DE,
"KUEMAIL" VARCHAR(64) COLLATE DE_DE,
"KUMEMO" BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
"KUNOTIZ" BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
"KUBRANCHE" VARCHAR(64) COLLATE DE_DE,
"KUBLZ" INTEGER,
"KUBANKKONTO" DOUBLE PRECISION,
"KUIBAN" VARCHAR(34) COLLATE DE_DE,
"KUBIC" VARCHAR(11) COLLATE DE_DE,
"KUCI" VARCHAR(35) COLLATE DE_DE,
"KUUMR" VARCHAR(32) COLLATE DE_DE,
"KUUMRDATUM" DATE,
"KUKTOINHNAME" VARCHAR(64) COLLATE DE_DE,
"KUREGNR1" VARCHAR(10) COLLATE DE_DE,
"KUREGDAT1" DATE,
"KUREGNR2" VARCHAR(10) COLLATE DE_DE,
"KUREGDAT2" DATE,
"KUREGNR3" VARCHAR(10) COLLATE DE_DE,
"KUREGDAT3" DATE,
"KUREGNR4" VARCHAR(10) COLLATE DE_DE,
"KUREGDAT4" DATE,
"KUREGNR5" VARCHAR(10) COLLATE DE_DE,
"KUREGDAT5" DATE,
"KUREGNR6" VARCHAR(10) COLLATE DE_DE,
"KUREGDAT6" DATE,
"KUSERVICEVERTRAG" SMALLINT,
"KUWARTDATUM" DATE,
"KUWARTDATUMBIS" DATE,
"KULAUFZEITBIS" DATE,
"KUVERTRAGMEMO" BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
"KUKUNDETYP" INTEGER,
"KUVERSIONSNR" VARCHAR(16) COLLATE DE_DE,
"KUINIVERSIONSNR" INTEGER,
"KUNETZLIZENZ" INTEGER,
"KUADSVERSION" VARCHAR(12) COLLATE DE_DE,
"KUOBJEKTLIZENZEN" INTEGER,
"KUEINHEITLIZENZEN" INTEGER,
"KUMOBILAPPLIZENZEN" INTEGER,
"KUCLOUDLIZENZEN" INTEGER,
"KUSEKTIONSNAME" VARCHAR(64) COLLATE DE_DE,
"KUZUSATZMEMO" BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
"KUPASSWORT" VARCHAR(13) COLLATE DE_DE,
"KUGUID" VARCHAR(22) COLLATE DE_DE,
"KUUPDATE" DATE,
"KUZEITJEEINHEIT" SMALLINT,
"KUFREIEEINHEITEN" SMALLINT,
"KUSTUNDENSATZ" DOUBLE PRECISION,
"KUZEITJEFREIEEINHEIT" SMALLINT,
"KUINIKUNDE" VARCHAR(128) COLLATE DE_DE,
"KUINIZUSATZ" BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
"KUUPDATEBERECHTIGT" BOOLEAN,
"KUUPDATEPRIORITAET" SMALLINT,
"KUUPDATERUECKSPRACHE" BOOLEAN,
"KUURL" VARCHAR(64) COLLATE DE_DE,
"KURGFIRMA1" VARCHAR(64) COLLATE DE_DE,
"KURGFIRMA2" VARCHAR(64) COLLATE DE_DE,
"KURGSTRASSE" VARCHAR(64) COLLATE DE_DE,
"KURGPLZ" VARCHAR(5) COLLATE DE_DE,
"KURGORT" VARCHAR(64) COLLATE DE_DE,
"KURGLKZ" VARCHAR(3) COLLATE DE_DE,
"KURGMEMO" BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
"KUKTOINHVORNAME" VARCHAR(64) COLLATE DE_DE,
"KUKTOINHSTRASSE" VARCHAR(64) COLLATE DE_DE,
"KUKTOINHPLZ" VARCHAR(5) COLLATE DE_DE,
"KUKTOINHORT" VARCHAR(64) COLLATE DE_DE,
"KUKTOINHLKZ" VARCHAR(3) COLLATE DE_DE,
"KULA" BOOLEAN,
"KULADATUM" DATE,
"KULABEMERKUNG" BLOB SUB_TYPE TEXT SEGMENT SIZE 80,
"KUARCHIVPFAD" VARCHAR(255) COLLATE DE_DE,
"KUSPERRE" BOOLEAN,
"KUALTKUNDE" BOOLEAN,
"KUVORKASSE" BOOLEAN,
"KURABATT" DOUBLE PRECISION,
"KUBENUTZERNR" SMALLINT,
"KUBENUTZERDT" TIMESTAMP,
"KULAVERFAHREN" SMALLINT
);
CREATE UNIQUE INDEX "IDX_KUPRIMARY" ON "KUNDE"("KUID");

CREATE TABLE "KUNDESTAFFEL"
(
"KSKUNDENNR" INTEGER,
"KSDATUM" DATE,
"KSNETTOBETRAG" DOUBLE PRECISION,
"KSNETTOADS" DOUBLE PRECISION,
"KSRABATT" DOUBLE PRECISION,
"KSLASTSCHRIFT" BOOLEAN,
"KSZAHLUNGSPERIODE" SMALLINT,
"KSBEMERKUNG" VARCHAR(255) COLLATE DE_DE
);
CREATE UNIQUE INDEX "IDX_KSPRIMARY" ON "KUNDESTAFFEL"("KSKUNDENNR", "KSDATUM");

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02