[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Mathematic Calculations on Fields

Posted on 2011-04-19
4
Medium Priority
?
388 Views
Last Modified: 2012-05-11
I have a column in a table that I would like to make some calculations on, I would like to add some percentages to the output..

e.g select price + (10%+5% ) FROM table

The 10% and 5% would each be a percentage of the price to be added back to the price to get the total including the percentages..

Thanks in Advance
0
Comment
Question by:Eaddy Barnes
  • 3
4 Comments
 
LVL 24

Accepted Solution

by:
jimyX earned 2000 total points
ID: 35422246
it can be as follows:
select (price + (price * 10/100) + (price * 5/100)) FROM table
0
 
LVL 24

Assisted Solution

by:jimyX
jimyX earned 2000 total points
ID: 35422626
For shorter line:
select (price + (price * 0.1) + (price * 0.05)) FROM table
0
 
LVL 11

Author Comment

by:Eaddy Barnes
ID: 35422738
hey guys another question, how would I write the statement for calculating something like 6.62% of the price?
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35422851
(price * ( 6.62 / 100 ))
or
(price * 0.0662)
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we’ll look at how to deploy ProxySQL.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question