Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JOIN inColdFusion QoQ
<cfset q1=QueryNew(
"Date,User,Col1,Col2,Col3",
"varchar,varchar,integer,integer,integer",
[
{
Date = "08/2019",
User = "Sam",
Col1 = 1,
Col2 = 2,
Col3 = 3
},
{
Date = "09/2019",
User = "Sam",
Col1 = 5,
Col2 = 7,
Col3 = 8
}
]
)>
<cfset q2=QueryNew(
"Date,User,Col4,Col5",
"varchar,varchar,integer,integer",
[
{
Date = "09/2019",
User = "Sam",
Col4 = 4,
Col5 = 5
}
]
)>
<cfdump var="#q1#">
<cfdump var="#q2#">
<cfset qCombined = QueryExecute("SELECT *
FROM q1, q2
WHERE q1.User = q2.user",
[],
{ dbtype = "query"}
)>
<cfdump var="#qCombined#">