Using Coldfusion's ValueList() to evaluate dynamic Query column names

Occasionally I use Coldfusion’s valuelist() function to generate a comma separated list from a query. The syntax of this function will only allow the function call use a static variable and cannot use a dynamically generated value.

I just found a great tip from Richard Davies’ blog: You can use the array ToList function in place of the valuelist() function which will evaluate correctly at runtime.