You think correctly.. the function is (from the online help):
----------------------------------------
ValueList
Returns a comma-separated list of the values of each record returned from a
previously executed query.
See also QuotedValueList.
Syntax
ValueList(query.column [, delimiter ])
query.column
Name of an already executed query and column. Separate query name and column
name with a period ( . ).
delimiter
A string delimiter to separate column data.
Example
<!--- 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>
-----Original Message-----
From: Paul Sinclair [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 12 June 2001 8:12 AM
To: CF-Talk
Subject: Simple: How do I get query results in a list
I have a query like:
<cfquery name="getNumbers" datasource="whatever">
select field1
from myTbl
where field2=100
</cfquery>
How do I output the result set as a list? I think there is a built-in
function for this but I can't remember what it is and can't find it in my CF
bibles.
Thanks,
Paul Sinclair
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists