Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP's answer to COUNT(*) ??
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01338680
Message ID:
01338682
Vues:
10
I don't understand the question precisely, but COUNT(DISTINCT(myField)) as NumRows should work.

Otherwise COUNT(*) is your answer, since it works the same way as in SQL Server.

>Hi all,
>
>I'm working with a client (still on VFP 8 for another month or so, unfortunately) who has the following SELECT statement choosing data from a VFP free table:
>
>
>SELECT ALL ;
>		SUM( Production.paidamt )   AS nPaidAmount ;
>	FROM ( ADDBS( lcLocationProduction ) + [Persons] ) AS ProductionMaster ;
>	INTO CURSOR curAmountsPrevious ;
>	WHERE ProductionMaster.campaign = lcCampaign ;
>		AND ProductionMaster.intype = lcType ;
>		AND BETWEEN( TTOD( ProductionMaster.tcurdate ), ;
>						curDates.dPreviousPledgesStart, ;
>						ldPledgesStop ;
>					) ;
>		AND TTOD( ProductionMaster.paiddate ) <= ldPledgesStop ;
>	GROUP BY intype
>
>
>Now, they want to (quickly) add a count of the number of rows grouped to the SELECT statement (ie, "x" rows for this "intype" were what made up this "nPaidAmount" number). If this was SQL Server data, I'd do it with
>
>COUNT(*) AS nPaidCount, ;
>
>just above the SUM() statement.
>
>However, I can't seem to find a comparable approach to the COUNT() function when querying against VFP tables. I've searched the message archives for the last three years of messages here, and didn't find anything.
>
>Anybody got a quick idea on this one?
>
>TIA,
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform