I have upgraded my Lucee to the latest version, 5.4.2.17, and when I tested with my test case, it seems this QoQ still has bugs if we use IFNULL in where. Below is my test code:
<cfset qExpEmp = QueryNew(“payrollyear, amount, xhour, xday, price, clientnr”,
“Integer,Decimal,Decimal,Integer,Decimal,varchar”)>
<cfset tmp = querySetCell(qExpEmp,“payrollyear”,“2022”)>
<cfset tmp = querySetCell(qExpEmp,“amount”,“-216.81”)>
<cfset tmp = querySetCell(qExpEmp,“xhour”,“-8.25”)>
<cfset tmp = querySetCell(qExpEmp,“xday”,“1”)>
<cfset tmp = querySetCell(qExpEmp,“price”,“26.2800”)>
<cfset tmp = querySetCell(qExpEmp,“clientnr”,“5”)>
query 1:
SELECT payrollyear ,sum(amount) as amount ,sum(xhour) as vhour ,sum(xday) as vday ,sum(price) as totprice FROM qExpEmp WHERE payrollyear = '2022' AND clientnr = '5' GROUP BY payrollyear, price, clientnr
query2 (wrong result):
SELECT payrollyear
,sum(amount) as amount
,sum(xhour) as vhour
,sum(xday) as vday
,sum(price) as totprice
FROM qExpEmp
WHERE payrollyear = ‘2022’
AND IFNULL(clientnr,‘’) = ‘5’
GROUP BY payrollyear, price, clientnr
as you see in the dump result the result amount -1 is wrong