And it is a shame that it doesn't support outer joins, but the above example is very similar, using an INNER JOIN, the different between the two is the fact that appid in Q1 and Q2 must exist for a record to be returned using an INNER JOIN. So if q1.appid has a value of 3 but q2 doesn't have a 3 for appid, it won't return that row whatsoever, since q2 doesn't have the value of 3 for appid in any of its rows.
But with OUTER JOINS, it returns NULL if it cannot find the same value in the second table that is being joined. Only inner joins are supported by Coldfusion Queries of Queries, and should work out well for you.
<cfquery name="Q3" dbtype='Query'>
SELECT Q1.AppID, Q1.AppAcronym, Q1.AppPriority, Q1.AppType, Q1.AppStatus, Q2.SysName, Q2.SysStatus, Q2.SysType, Q2.SysOS, Q2.SysOSType
FROM Q2, Q1
Q2.AppID = Q1.AppID
</cfquery>
Goodluck!
Main Topics
Browse All Topics





by: andw928Posted on 2005-08-29 at 12:00:06ID: 14778260
Find
SELECT Q1.AppID, Q1.AppAcronym, Q1.AppPriority, Q1.AppType, Q1.AppStatus, Q2.SysName, Q2.SysStatus, Q2.SysType, Q2.SysOS, Q2.SysOSType
FROM Q2 RIGHT OUTER JOIN
Q1 ON Q2.AppID = Q1.AppID
Replace With:
SELECT Q1.AppID, Q1.AppAcronym, Q1.AppPriority, Q1.AppType, Q1.AppStatus, Q2.SysName, Q2.SysStatus, Q2.SysType, Q2.SysOS, Q2.SysOSType
FROM Q2, Q1
WHERE q2.appid = q1.appid
Unfortunately, outer joins are not supported by CFMX query of query.