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
</cfquery>

<!--- 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'
</cfquery>


IMPORTANT:
Make sure that there is NO SQL comments( "--" and "/* */") in the second query or you will see error message "
Error Executing Database Query".
arrow
arrow
    全站熱搜

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