Coldfusion 多個 query 合併
簡單的用法: <cfquery name="q1" datasource="store1" blockFactor="100"> select * from sales_lists where sale_date = '2013/05/02' </cfquery> <cfquery name="q2" datasource="store2" blockFactor="100"> select * from sales_lists where sale_date = '2013/05/02' </cfquery> <cfquery name="datesales" dbtype="query"> select * from q1 union select * from q2 order by sale_employee </cfquery> 把多個 DB 查詢用 in memory 查詢 union 起來。 那如果是 LOOP 迴圈連續查詢的 query 呢? 那就讓 query name 不一樣就可以了,然後再用LOOP把query union 起來 <cfloop from="1" to="#ListLen(employeelist)#" index="i"> <cfquery name="qresult#i#" datasource="db1"> select * from employee where employee_no = '#ListGetAt(i)#' </cfquery> </cfloop> <cfquery name="combine" dbtype="query"> <cfloop fro...