Home     All Posts     RSS XML     Search     Contact

Marketplace

Sal 23

Posted on May 21, 2010.
Sal 23SQL how to handle it?

I came into this SQL command for a specific answer, I had the answer, but it is too long how can I shorten it, if anyone knows it would be nice ...
Code input:
SELECT ENAME, JOB, SAL, COMM, SAL COMM +, 100 * (COMM / (SAL + COMM)) From EMP WHERE COMM IS NOT NULL;
Result "100 * (COMM / (SAL + COMM))" = 52.830188679245283018867924528301886792 ...
How can I reduce this to perhaps = 52.8301.
Please help, thank you ...

try this:

SELECT ENAME, JOB, SAL, COMM, SAL COMM + ROUND (100 * (COMM / (SAL + COMM)), 4) EMP WHERE COMM IS NOT NULL;

SELECT ROUND (blah, 4) would circle the answer to 4 decimal places (where blah = expression). Or TRUNC (blah, 4) it would truncate the first four digits after the decimal point.

SELECT ENAME, JOB, SAL, COMM, SAL + COMM
CAST (100 * (COMM / (SAL + COMM)) AS DECIMAL (8,4)) From EMP WHERE COMM IS NOT NULL

Share |

Comments

There are no comments.

Leave a Comment

Your Name
Your Email
Comments
Human Check. Type 3972.

Newest Posts
Big Size Clothes
Skechers Usa
Asics Cumulus 9
Dog Hiking Boots
Protective Footwear
Josmo
Hiking Boots Brands
New Balance 1201

Other Sites
Honest Shoes
Doss Clothing
Grind Clothes
Boat Surf
Bop Baby
Sport Apparel
Sport Clothes
Formal Clothing
Jewelry Juice
Jewellery Seduction
Nintendo.cm
Maternity Clothes