Just a note - I know I can construct the whole thing as a string and evaluate it.
So this works:
eval parse “select sum col1 by “,string[colname],” from .ta.t”
I was wondering if there is something else. Why? I have a fairly complex multi-line query that aggregates data in a table.
I would like to be able to aggregate by different columns and provide one function that I can call with the name of the column to aggregate by.
The eval/parse solution would work, but then my function and complex query becomes one large string to concatenate - workable, but not the most elegant solution.
Thanks much Simon - will take a look at Aaron’s code. I am not working on that particular problem currenlty - when I get back to it, I will try out the above suggestions and post back if there is anything of interest to others.