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

From: eadbha...@yahoo.com.mx [firebird-support] 
Sent: Monday, September 4, 2017 7:34 PM
To: firebird-support@yahoogroups.com 
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





---
Ta wiadomość została sprawdzona na obecność wirusów przez oprogramowanie 
antywirusowe Avast.
https://www.avast.com/antivirus
  • [firebird-suppo... eadbha...@yahoo.com.mx [firebird-support]
    • Re: [fireb... 'livius' liviusliv...@poczta.onet.pl [firebird-support]
      • Re: [f... Svein Erling Tysvær setys...@gmail.com [firebird-support]

Reply via email to