|
|
I get a lot of help from http://easycfm.com. One of the guys there posted a
http://www.bealearts.co.uk/blog/2007/06/20/how-to-do-an-outer-join-in-query-of-q
ueries/ on how to do outter joins on QofQs. That way you get all the
information from both tables, even if they aren't the same.
<cfquery name="joinQuery" dbtype="query" >
SELECT *
FROM QueryB
WHERE QueryB.ID = -1
</cfquery>
<cfset QueryAddRow(joinQuery) />
<cfquery name="result" dbtype="query" >
SELECT *
FROM QueryA, QueryB
WHERE QueryA.ID = QueryB.ID
UNION
SELECT QueryA.*, joinQuery.*
FROM QueryA, joinQuery
WHERE QueryA.ID NOT IN (#ValueList(QueryB.ID)#)
</cfquery>
|
|