Feature request: Database column loop

The concept here is to have a ‘database query’ version of ‘column list loop’, in particular with a ‘loop end’ that supports column append. The idea would be to build up a series of embedded SQL select statements that have the effect of producing a single query that will add multiple columns to an existing table based on the columns in that table.

One use case for this would be to prepare a large table for predictive modelling - so, for example, filling nulls or calculating rolling sums as database queries. This can be achieved now using a regular column loop and then iteratively writing old and new columns to a temporary table, dropping the old table, renaming the temp version as the existing table, then restarting the loop and re-selecting the table - but it is a relatively slow process. Being able to do all this at the SQL level and then subsequently build the required table with a single statement would be an enormous efficiency gain.

Hi Andrew,
can you elaborate a bit more on the idea. Should the node create a new temporary table within each iteration or should this loop create a single sql query e.g. by joining another sql query to the existing query in each loop iteration? How would the loop body look like and how would the loop know when to stop and how to join previous results with the result of the current iteration?