query of queries simple example :

<!--- Main query which will be used later. --->
<cfquery name="qry_apply_list" datasource="#application.odbc#">
    /** Comments */
    select jobno,count(jobno) cnt    
    from apply_list
    group by jobno

<!--- Query from main query.
Set dbtype attribute to "query" of the second query section to query from an existing result set. --->
<!--- Place the name of the main query just after "from" syntax (where should be a table name). --->
<cfquery dbtype="query" name="qry_apply_list_detail">
    SELECT cnt
    from qry_apply_list
    where jobno = 'mailman'

Make sure that there is NO SQL comments( "--" and "/* */") in the second query or you will see error message "
Error Executing Database Query".
創作者 swangs 的頭像


swangs 發表在 痞客邦 留言(0) 人氣()