Is it possible to use a “joker selector” into a SELECT request, in order to be able to get an undefined number of column according to what is contained in their name?
For example, I want to get all the %_FK columns using a request like:
SELECT `%_FK`
FROM `table`
WHERE `FILTER` = 'value';
There’s more info about this here:
Selecting all columns that start with XXX using a wildcard?
I would suggest preparing the column names in your used programming language, and then push them into the query string afterwards.