Errrrr....
'WHERE ' +
'((Fluit_Seizoen_ID=:Wed_Seizoen_ID) or :Wed_Seizoen_ID=0) ' +
'OR ' +
How in blazes is this supposed to work?
A Parameter left-hand-side of equal-sign?!?!?!
Next: What are you trying to get with that Replace/Coalesce-Thingy?
The Coalesce is wrong there.
You need coalesce for Fields returning from a Left Join. You are using it on Fields from the "Master"-Table
If it is SQLite, change your Create table-Statement to this
'CREATE TABLE tbl_Scheidsrechters (' +
'Scheids_ID WORD NOT NULL PRIMARY KEY ASC, ' +
'Scheidsrechter TEXT GENERATED ALWAYS AS ("Voornaam"||' '||"Tussenvoegsel"||' '||"Achternaam") VIRTUAL, ' +
'Voornaam VARCHAR(20), ' +
'Tussenvoegsel VARCHAR(10), ' +
'Achternaam VARCHAR(50), ' +
'Adres VARCHAR(60), ' +
'Postcode VARCHAR(6), ' +
'Woonplaats VARCHAR(40), ' +
'Telefoon VARCHAR(11), ' +
'Mobiel VARCHAR(11), ' +
'Geboortedatum DATE, ' +
'Email VARCHAR(250), ' +
'IBAN VARCHAR(18)' +
')';
Then it should work with
cSQL := 'SELECT ' +
'CAST(REPLACE(tbl_Scheidsrechters.Scheidsrechter, " ", " ") AS CHAR) AS Scheidsrechter, ' +
'tbl_Scheidsrechters.Voornaam, ' +
'tbl_Scheidsrechters.Tussenvoegsel, ' +
'tbl_Scheidsrechters.Achternaam, ' +
'tbl_Scheidsrechters.Scheids_ID ' +
'FROM tbl_Scheidsrechters ' +
'LEFT JOIN tbl_Licenties ON tbl_Licenties.Fluit_Scheids_ID = tbl_Scheidsrechters.Scheids_ID ' +
'WHERE ' +
'((Fluit_Seizoen_ID=:Wed_Seizoen_ID) or :Wed_Seizoen_ID=0) ' + /*?!?!?!?!?!?!*/
'OR ' +
'(Scheids_ID IN (1,2,3,4)) ' +
'GROUP BY 1,2,3,4,5 ' +
'ORDER BY ' +
'tbl_Scheidsrechters.Achternaam, ' +
'tbl_Scheidsrechters.Voornaam;';
btw: You are using unqualified Fieldnames there (in the WHERE-Clause).
Don't!
Always qualify Fieldnames with its table, and use Table-Aliases!
because if i read this correctly your WHERE-Clause actually turns your LEFT JOIN into an INNER JOIN
Untested, though.
And i repeat: If it is SQLite.....