home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Documentation / snippets / quotedvaluelist.cfm < prev    next >
Encoding:
Text File  |  1999-04-12  |  1010 b   |  44 lines

  1. <!--- This example shows the use of QuotedValueList --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>
  7. QuotedValueList Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  12. <BODY  bgcolor="#FFFFD5">
  13.  
  14. <H3>QuotedValueList Example</H3>
  15.  
  16. <!--- use the contents of one query to create another
  17. dynamically --->
  18. <CFSET List = "'BIOL', 'CHEM'">
  19.  
  20. <!--- first, get the department ids in our list --->
  21. <CFQUERY NAME="GetDepartments" DATASOURCE="cfsnippets">
  22. SELECT Dept_ID FROM Departments
  23. WHERE Dept_ID IN (#PreserveSingleQuotes(List)#)
  24. </CFQUERY>
  25.  
  26. <!--- now, select the courses for that department based
  27. on the quotedValueList produced from our previous query --->
  28. <CFQUERY NAME="GetCourseList" DATASOURCE="cfsnippets">
  29. SELECT     *
  30. FROM     CourseList
  31. WHERE     Dept_ID IN (#QuotedValueList(GetDepartments.Dept_ID)#)
  32.  
  33. </CFQUERY>
  34.  
  35. <!--- now, output the results --->
  36. <CFOUTPUT QUERY="GetCourseList" >
  37. <PRE>#Course_ID#    #Dept_ID#    #CorNumber#    #CorName#</PRE>
  38. </CFOUTPUT>
  39.  
  40.  
  41. </BODY>
  42.  
  43. </HTML>       
  44.