Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compound Select
Message
 
 
To
28/08/2008 12:03:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01342599
Message ID:
01342620
Views:
10
This message has been marked as the solution to the initial question of the thread.
>The table looks like this:
>
>receiveddate;category;amount;fisyear
>There is only one record per category per month. So there is no need to sum.
>The pair of selects produces a cursor containing a column for category and each month. It looks like this:
>category;sep;oct;nov;fisyear (plus the other months.)
>This is exactly what I want except I only get the first fisyear. What I would like to do now is add a second set of records to the result for the second fisyear and a third set of records for the third fisyear an so on. I could do this by creating an empty result cursor and then appending the results into it while SCANing through the fisyears but I thought there might be a way to accomplish it with just the SELECT.

Try
select sum(iif(Month(receiveddate)=1,Amount,000000000000)) as Jan, ...., FisYear, 
Category group by FisYear, Category
Actually, looks like this select alone will give you what you want.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform