Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compound Select
Message
 
 
À
28/08/2008 12:03:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01342599
Message ID:
01342620
Vues:
11
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform