#1 2021-12-19 17:45:21

larand54
Member
Registered: 2018-12-25
Posts: 104

Complex join with createJoined

Is the following SQL realizable with the "TSQLRecord.createJoined" function or is there better alternatives?

I try to avoid running the SQL-script in the program due to fear of"SQL-Injection".
It's about an old legacy database. I have tested the function in simpler case where you use only one common field which work perfectly.

SELECT TE.AddressName, TC.Customername FROM tbl_A TA
 join tbl_B TB ON TB.CustomerNo = TA.CustomerNo
 join tbl_C TC ON TC.CustomerNo = TA.CustomerNo
 join tbl_D TD ON TD.CustomerNo = TA.CustomerNo AND TD.AddressNo = TC.AddressNo
 join tbl_E TE ON TE.AddressNo = TD.AddressNo

Delphi-11, WIN10

Offline

#2 2021-12-19 17:50:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,653
Website

Re: Complex join with createJoined

No, it is not suported.
Only a single level join is supported - as documented.

Just use the SQL like directly.
There is no parameter involved, so it is free from any SQL injection threat.

Offline

Board footer

Powered by FluxBB