How do I get the values from one column in a query?

If you need to retrieve the values from one column in a query, ColdFusion provides the valueList() function. It will return every value from that column. Here is an example:

<cfquery name="getPeople" datasource="people">
select name, age, rank
from people
<cfset allNames = valueList(>

Note that valueList does not take a string, but the actual query and column variable.

This question was written by Raymond Camden
It was last updated on March 23, 2006.




comments powered by Disqus