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

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Query

Author  Topic 

sunny_10
Yak Posting Veteran

72 Posts

Posted - 2014-11-26 : 00:13:44
Hi

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.


Thanks

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-26 : 12:05:53
[code]
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
   

- Advertisement -