Subject COUNT DISTINCT issue in Fb 2.5
Author

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