Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditionally counting in SQL
Message
 
 
To
08/05/2005 11:41:18
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01012011
Message ID:
01012023
Views:
21
Tariq,

You can use sum(iif(mode="L",1,0)) as bagsLC to get your count, and sum(iif(mode="L",weight,0)) as bagsLS

>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
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform