home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / quotedvaluelist.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  948 b   |  43 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. <BODY>
  12.  
  13. <H3>QuotedValueList Example</H3>
  14.  
  15. <!--- use the contents of one query to create another
  16. dynamically --->
  17. <CFSET List = "'BIOL', 'CHEM'">
  18.  
  19. <!--- first, get the department ids in our list --->
  20. <CFQUERY NAME="GetDepartments" DATASOURCE="cfsnippets">
  21. SELECT Dept_ID FROM Departments
  22. WHERE Dept_ID IN (#PreserveSingleQuotes(List)#)
  23. </CFQUERY>
  24.  
  25. <!--- now, select the courses for that department based
  26. on the quotedValueList produced from our previous query --->
  27. <CFQUERY NAME="GetCourseList" DATASOURCE="cfsnippets">
  28. SELECT     *
  29. FROM     CourseList
  30. WHERE     Dept_ID IN (#QuotedValueList(GetDepartments.Dept_ID)#)
  31.  
  32. </CFQUERY>
  33.  
  34. <!--- now, output the results --->
  35. <CFOUTPUT QUERY="GetCourseList" >
  36. <PRE>#Course_ID#    #Dept_ID#    #CorNumber#    #CorName#</PRE>
  37. </CFOUTPUT>
  38.  
  39.  
  40. </BODY>
  41.  
  42. </HTML>       
  43.