Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hello,
Got a trouble with the percentage in SQL. To be more precise, it is required to take a certain percentage off of a row in the column. For example (taking 40% of the row's amount). Any help will be appreciated. Thanks.

What I have tried:

I tried different queries and subqueries but none of them gives the desired result.
Posted
Updated 24-Jun-22 18:46pm
Comments
Member 15627495 25-Jun-22 0:47am    
read this sum up about percentage :
https://www.sqlshack.com/sql-percentage-calculation-examples-in-sql-server/

you'll find what you need sure

1 solution

SQL
SELECT ID, ValueColumn, ValueColumn - ValueColumn * 40 / 100 As [40% Off] FROM MyTable
 
Share this answer
 

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