Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

72 Posts

Posted - 11/26/2014 :  00:13:44  Show Profile  Reply with Quote

I am displaying data with fields name,code,amount . I have 2 variables Percentage & Limit . I want when percentage amount is calculated on amount field , if it is less than Value in Limit variable then it should display that value else if greater than LIMIT value should be displayed.


Flowing Fount of Yak Knowledge

2780 Posts

Posted - 11/26/2014 :  12:05:53  Show Profile  Reply with Quote
SELECT name, code, amount,
CASE WHEN Percentage * Amount < Limit
THEN Percentage * Amount
ELSE Limit
END AS Percentage_Amount_Or_Limit
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000