Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Kick Start My Brain
Message
 
 
To
17/02/2011 12:55:55
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01500443
Message ID:
01500569
Views:
28
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform