Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
DECLARE @Amount NUMERIC(16,2) 
SELECT @Amount=isnull(64400.00,0) * (Power((1 +(ISNULL(Amount,0.00)/100)),isnull(13,0))-1) FROM biz_FineSetup 
WHERE FeeHeadID=80      
AND ClassID=42           
AND SectionID=299          
AND CategoryID=12       
AND SchoolID=1  
SELECT @Amount


What I have tried:

Above I write Query and I am Getting OutPut Like 30173.59

but My Correct Output will be 3087 so how to get correct value please help
Posted
Updated 2-Mar-20 20:17pm
v2
Comments
Maciej Los 3-Mar-20 1:56am    
Do you think that we are clairvoyants?

1 solution

We can't help you directly - we don;t have access to your DB, so we have no idea what values are in the Amount Column for the selected row, and that's fundamental to the calculation.

So start by adding Amount to the SELECT list, and returning that and your calculated value - you can then start to work out what is going on. but that's some weird code: isnull(64400.00,0) and isnull(13,0) are always going to return 64400.00 and 13 respectively ...
 
Share this answer
 
Comments
Member 12183079 3-Mar-20 2:34am    
Amount Column Value is 3.00
OriginalGriff 3-Mar-20 2:46am    
And why do you think that
64400.00 * (Power((1 +(3.0/100)),13)-1)
should be 3087?
64400.00 * (1.030000 to the power 13)-1)
Will be 30173.59 ...
Maciej Los 3-Mar-20 2:39am    
5ed!
Member 12183079 3-Mar-20 3:52am    
because i am calculating like amount percent like 3 percent
OriginalGriff 3-Mar-20 4:09am    
3% of what?
3% of 64400 is 1932 not 3087 ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900