Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Count(distinct field) work incorrect
Message
De
21/02/2006 18:19:15
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
 
 
À
20/02/2006 03:35:07
Cristian Tenea
Aquila Part Prod Com
Ploiesti, Roumanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01097464
Message ID:
01097960
Vues:
16
>select id1, count(distinct 'field') as cntfld form table1 group by id1

>select distinct 'field' from table1 where id1=somevalue
>
>number of records in second case is different from cntfld form first case for same value of id1

Hi Christian,

Is there any chance you've got Null values in your table?
Create Cursor TestCount (Field1 I Null, Field2 C(10) Null)
Insert Into TestCount Values (1, "One")
Insert Into TestCount Values (1, "One A")
Insert Into TestCount Values (1, .Null.)
Insert Into TestCount Values (.Null., "Null")
Insert Into TestCount Values (2, "Two")
Select Count(Distinct Field2) ;
From TestCount ;
	Where Field1 = 1    && 2

Select Distinct Field2 ;
	From TestCount ;
	Where Field1 = 1    && 3 rows
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform