Returns a comma-separated list of the values of each record returned from a previously executed query.
ValueList(query.column [, delimiter ])
| Parameter |
Description |
|---|---|
| query.column |
Name of an executed query and column. Separate query name and column name with a period. |
| delimiter |
A string delimiter to separate column data. |
<!--- This example shows the use of ValueList --->
<html>
<head>
<title>ValueList Example</title>
</head>
<body>
<H3>ValueList Example</H3>
<!--- use the contents of one query to create another
dynamically --->
<cfquery name = "GetDepartments" datasource = "cfsnippets">
SELECT Dept_ID FROM Departments
WHERE Dept_ID IN ('BIOL')
</cfquery>
<cfquery name = "GetCourseList" datasource = "cfsnippets">
SELECT *
FROM CourseList
WHERE Dept_ID IN ('#ValueList(GetDepartments.Dept_ID)#')
</cfquery>
<cfoutput QUERY = "GetCourseList" >
<PRE>#Course_ID# #Dept_ID# #CorNumber# #CorName#</PRE>
</cfoutput>
</body>
</html>