Returns a comma-separated list of the values of each record returned from a previously executed query. Each value in the list is enclosed in single quotes.
See also ValueList.
QuotedValueList(query.column [, delimiter ])
Name of an already executed query and column. Separate query name and column name with a period ( . ).
A string delimiter to separate column data.
<!----------------------------------------------------------- This example shows the use of QuotedValueList, ValueList, and PreserveSingleQuotes. -------------------------------------------------------------> <HTML> <HEAD> <TITLE> QuotedValueList Example </TITLE> </HEAD> <BODY> <H3>QuotedValueList Example</H3> <!--- use the contents of one query to create another dynamically ---> <CFSET List="'Sales','Training','HR'"> <!--- first, get the department ids in our list ---> <CFQUERY NAME="GetDepartments" DATASOURCE="HRApp"> SELECT Department_ID FROM Departments WHERE Department_Name IN (#PreserveSingleQuotes(List)#) </CFQUERY> <!------------------------------------------------------ now, find the employees in the departments based on the previous query. --------------------------------------------------------> <CFQUERY NAME="GetEmployees" DATASOURCE="HRApp"> SELECT Employee_ID, FirstName, LastName, Department_ID FROM Employees WHERE Department_ID IN (#ValueList(GetDepartments.Department_ID)#) </CFQUERY> <!------------------------------------------------------ Now, find the employees in the departments based on the previous query, using QuotedValueList. --------------------------------------------------------> <CFQUERY NAME="GetEmployeeInfo" DATASOURCE="HRApp"> SELECT FirstName, LastName, Department_ID, StartDate FROM Employees WHERE LastName IN (#QuotedValueList(GetEmployees.LastName)#) AND FirstName IN (#QuotedValueList(GetEmployees.FirstName)#) </CFQUERY> <!--- now, output the results ---> <CFOUTPUT QUERY="GetEmployeeInfo" > #FirstName# #LastName# (#Department_ID# ) <BR> </CFOUTPUT> </BODY> </HTML>