Icon View Incident Report

Serious Serious
Reported By: Barry McClure
Reported On: 10/8/2012
For: Version 2.10 Build 1
# 3639 Sub-Queries Nested within Aggregates in SELECT Statements Can Return Incorrect Results

I have a problem with Subselects returning the same value even though they have different Where clauses.It seems to be ignoring part of the Where clause that has "texp2.expense_code='LNC".

If I omit the "/sum(income)" it returns proper values. It appears to me EDB thinks both subselects are the same and will get the value for the 2nd subselect from the cache of the 1st subselect.

select
sum((select expense_amount from Expenses texp  where 
texp.cust_id=tc.cust_id   and texp.expense_code='PRK')) / 
sum(income)  as Avg_PRK
,sum((select expense_amount from Expenses texp2 where 
texp2.cust_id=tc.cust_id  and texp2.expense_code='LNC'))/ 
sum(income)  as Avg_LNC
from customers tc



Resolution Resolution
Fixed Problem on 10/8/2012 in version 2.11 build 1


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image