Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compound Select
Message
From
28/08/2008 17:37:07
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01342599
Message ID:
01342850
Views:
9
>>Given that this works
>>select crsB.category, orderby, jul,aug,sep,oct,nov,dec,Jan,Feb,Mar,apr,may,jun,FisYear ;
>>	from rta_revenuecategories crsA;
>>	inner join ( ;
>>	select ;
>>	sum(iif(month(receiveddate)=7,Amount,000000000000.00)) as jul, ;
>>	sum(iif(month(receiveddate)=8,Amount,000000000000.00)) as aug, ;
>>	sum(iif(month(receiveddate)=9,Amount,000000000000.00)) as sep, ;
>>	sum(iif(month(receiveddate)=10,Amount,000000000000.00)) as oct, ;
>>	sum(iif(month(receiveddate)=11,Amount,000000000000.00)) as nov, ;
>>	sum(iif(month(receiveddate)=12,Amount,000000000000.00)) as dec, ;
>>	sum(iif(month(receiveddate)=1,Amount,000000000000.00)) as Jan, ;
>>	sum(iif(month(receiveddate)=2,Amount,000000000000.00)) as Feb, ;
>>	sum(iif(month(receiveddate)=3,Amount,000000000000.00)) as Mar, ;
>>	sum(iif(month(receiveddate)=4,Amount,000000000000.00)) as apr, ;
>>	sum(iif(month(receiveddate)=5,Amount,000000000000.00)) as may, ;
>>	sum(iif(month(receiveddate)=6,Amount,000000000000.00)) as jun, ;
>>	FisYear, Category ;
>>	from rta_revenues ;
>>	group by FisYear, Category) crsB;
>>	on crsA.Category = crsB.Category ;
>>	order by FisYear, orderby ;
>>	into cursor crsRpt
>>suppose now we want to add a field to the result "fytotal" that will total all amounts for all categories within a single fisyear? I tried adding a
>>sum(amount) as fyTotal and a GROUP BY fisyear to the outside select but that didn't work.
>
>So, did you figure this out or need a little bit more help?
>
>Re: Functions in a select Thread #1341594 Message #1341630


The second hint did it.
Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform