Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Conditionally counting in SQL
Message
De
08/05/2005 11:41:18
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Conditionally counting in SQL
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Divers
Thread ID:
01012011
Message ID:
01012011
Vues:
70
Dear Experts

I have a dbf called "Avalbook" have following fields

date && type d
weight && type n
mode && type c
bags && type n

I want to get monthwise total of field weight
to do this I use following codes
SELECT MONTH(date) as nmonth,;
	CMONTH(date) as cmonth,;
	YEAR(date) as nyear,;
	sum(weight) as weight;
	from avlbook;
	GROUP BY nmonth,nyear ;
	ORDER BY nyear,nmonth;
	INTO CURSOR Temp
This work fine for me, but now I want to get the total of bags feild with following condition

count bags for mode="L" as bagsLc
count bags for mode="B" as bagsBc

sum(bags)for mode="L" as bagsLs
sum bags for mode="B" as bagsBs

Please modify above four lines to add in my query

Thanks in advace
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform