I was comparing the following queries in my local CF & Lucee servers. The ColdFusion server throws a QoQ runtime error. However, when I execute the same queries in Lucee, it returns the needed query results.
<cfquery name="getusers" datasource="myDSN">
SELECT
UC.UserContactName, U.UserID
FROM Users U
INNER JOIN UserContacts UC ON U.UserID = UC.UserID
WHERE U.UserID in (99,52,41,76,15)
</cfquery>
<cfquery name="getContactName" dbtype="query">
SELECT UserContactName FROM getusers
WHERE U.UserID = <cfqueryparam value="76" cfsqltype="cf_sql_integer">
</cfquery>
<cfdump var="#getContactName#" />
The CF server throws this error on the above code, because it considers the alias name:
The selected column reference U.UserID does not match any table in the FROM table list.
However, the Lucee server doesn't consider the alias name, ran runs the above without error. Does anyone know why the Lucee server does not consider the QoQ column alias name? Please share your thoughts or suggestions about this.