Icon View Incident Report

Serious Serious
Reported By: Kevin Koehne
Reported On: 9/26/2011
For: Version 2.05 Build 11
# 3506 Using the DISTINCT Clause with Aggregate Functions and GROUP BY Can Cause Incorrect Results

I’m encountering an issue with a query that I think may be a bug with Count(DISTINCT) returning incorrect numbers. I’ve tried to simplify this as much as possible, but it only shows up in a more complex query. I’m attaching the catalog and the tables in which the issue manifests.

The issue appears when I am running an aggregate query, grouping on an individual field and using COUNT(DISTINCT).

This issue is in the row with column Advertisement = 4. The correct count should be 25, not 30.

Select Advertisement,
      Count(Distinct ResNumber)
from tblguestdates dates
       inner join tblguestgeneral gen on dates.resnumber = gen.resnumber
       inner join tblguestroomrates rates on gen.Resnumber = rates.resnumber
Where ResDate >= Date '2011-9-25' and ResDate <= Date '2011-9-26'
and dates.Cancelled is Null
Group By Advertisement



And here is the result

Advertisement   Count of ResNumber
 
0               6
1               3
3               1
4               30
5               6
7               12
9               1
16              1



Resolution Resolution
Fixed Problem on 10/12/2011 in version 2.06 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