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.
QuotedValueList(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 QuotedValueList ---> <html> <head> <title>QuotedValueList Example</title> </head> <body> <H3>QuotedValueList Example</H3> <!--- use the contents of one query to create another dynamically ---> <cfset List = "'BIOL', 'CHEM'"> <!--- first, get the department ids in our list ---> <cfquery name = "GetDepartments" datasource = "cfsnippets"> SELECT Dept_ID FROM Departments WHERE Dept_ID IN (#PreserveSingleQuotes(List)#) </cfquery> <!--- now, select the courses for that department based on the quotedValueList produced from our previous query ---> <cfquery name = "GetCourseList" datasource = "cfsnippets"> SELECT * FROM CourseList WHERE Dept_ID IN (#QuotedValueList(GetDepartments.Dept_ID)#) </cfquery> <!--- now, output the results ---> <cfoutput QUERY = "GetCourseList" > <PRE>#Course_ID# #Dept_ID# #CorNumber# #CorName#</PRE> </cfoutput> </body> </html>