Icon View Incident Report

Minor Minor
Reported By: David Manton-Hall
Reported On: 4/20/2005
For: Version 4.19 Build 1
# 2013 SQL HAVING Clause Not Considering Integer and AutoInc Columns to Be Equivalent

Incorrectly parsing having clause:

11949 - Expression in Having clause not found in source columns in SELECT SQL

with the following SQL. The fact that the ID being counted is AutoInc is, I believe, fundamental to the problem. If I change the definition of ID to Integer, the problem dissappears.

drop table if exists Eric;

create table Eric (ID AutoInc, SourceID Integer);

insert into Eric values (NULL, 1);
insert into Eric values (NULL, 1);
insert into Eric values (NULL, 0);

select SourceID, Count(ID)
from Eric 
group by SourceID 
having Count(ID) >= 2;

Comments Comments and Workarounds

Thanks to David for the work-around, which is to select Count(ID) as TestCount and reference TestCount in the HAVING clause instead of Count(ID).

Resolution Resolution
Fixed Problem on 4/29/2005 in version 4.20 build 1

Products Affected Products Affected
DBISAM Additional Software and Utilities
DBISAM CLX Client-Server
DBISAM CLX Client-Server with Source
DBISAM CLX Standard with Source
DBISAM ODBC Client-Server
DBISAM ODBC Client-Server with Source
DBISAM ODBC Standard with Source
DBISAM VCL Client-Server
DBISAM VCL Client-Server with Source
DBISAM VCL Standard with Source