Subject Re: [firebird-support] COUNT DISTINCT issue in Fb 2.5
Author livius
Hi,
 
will be better to show sample script
create table
and insert into..
and db charset
then anyone can test this self
 
regards,
Karol Bieniaszewski
 
Sent: Monday, September 4, 2017 7:34 PM
Subject: [firebird-support] COUNT DISTINCT issue in Fb 2.5
 
 

Hi there,


I have this query:


select a.num_part, a.cve_prov, a.cve_impo, a.des_merc

from ctrac_clasif a

where a.num_part = '0630039046';

 

It yields this results:

 

NUM_PART CVE_PROV CVE_IMPO DES_MERC

========= ========= ========= ==========

0630039046 3400. 19 CUBIERTA

0630039046 3400. 19 CUBIERTA


As you can see,  the two resulting rows are identical.


Now I run the following aggregate query:


select a.num_part,a.cve_prov,a.cve_impo,COUNT(DISTINCT a.des_merc)

from ctrac_clasif a

where a.num_part = '0630039046'

group by a.num_part,a.cve_prov,a.cve_impo

 

NUM_PART CVE_PROV CVE_IMPO COUNT

========= ========= ========= ======

0630039046 3400. 19 2


Shouldn't COUNT be equals to 1? There's only one distinct value in the DES_MERC column.


Your help is much appreciated.


Regards,


Eduardo

 


Wolny od wirusów. www.avast.com