Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kick Start My Brain
Message
 
 
À
17/02/2011 12:55:55
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01500443
Message ID:
01500569
Vues:
29
>>T-SQL has some ideas for running totals (like Jeff Moden quirky update), but it's not official solution and not supported. So, for these kind of problems T-SQL may not be a good choice.
>>
>>Unless I misunderstood the problem.
>>
>>Perhaps you can post your table structure, what exactly do you want to get in SQL forum, then it will be easier to provide a solution.
>
>Maybe this will get me the number of premiums paid:
>
>
	SELECT NumberMonthsToAdd = SUM(
>		CASE [PremiumMode] 
>			 WHEN 'Monthly' THEN NumberOfPremiums * 1
>			 WHEN 'Quarterly' THEN NumberOfPremiums * 3
>			 WHEN 'Semi-Annually' THEN NumberOfPremiums * 6
>			 WHEN 'Annually' THEN NumberOfPremiums * 12
>			 ELSE 0
>		END )
>	FROM [dbo].[ReceiptDetails]
>
>
>This way I don't need to loop through to get the result. What do you think?

Looks good to me.
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