Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditionally counting in SQL
Message
From
08/05/2005 11:41:18
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Conditionally counting in SQL
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01012011
Message ID:
01012011
Views:
69
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
Next
Reply
Map
View

Click here to load this message in the networking platform