selectline-software / selectline-api

Apache License 2.0
24 stars 5 forks source link

Question: how to use SQL IN operator with macros #383

Closed capc0 closed 2 months ago

capc0 commented 2 months ago

If I have n identifiers (e.g. of documents) and want to query for some additional data via macros, I currently have to loop over the data and perform one request per document.

SELECT * FROM beleg WHERE Belegnummer = :param

Is it possible to only perform one request and use the SQL IN keyword?

SELECT * FROM beleg WHERE Belegnummer IN(:param)

Currently the parameter obviously gets escaped which prevents the usage of comma seperated values like A0001, A0002.

Details

MatthiasGuse commented 2 months ago

Hello,

this ist not possible. Internal we use the parameters of the SQL-Server, which allows only single values and no list of values.

Best regards

capc0 commented 2 months ago

understandable - thanks for the quick reply.