Link to home
Start Free TrialLog in
Avatar of MoreThanDoubled
MoreThanDoubled

asked on

query syntax

All,

How can i make 5000.000000 look like 50.00 using a sql statement?
Avatar of Sabora
Sabora

select ROUND(5000.00000 / 100, 2)
Avatar of MoreThanDoubled

ASKER

Sabora, this is close but i get 50.000000000 i want 50.00
ASKER CERTIFIED SOLUTION
Avatar of Sharath S
Sharath S
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
for postgresql, which I'm running here, this works fine.

So what does

select ROUND(50.002, 2)

print in your case?
would expect 50.000000 then, too...

Which DB system are you using?
Surely this will work

SELECT ROUND(COLUMNAME/100,2) FROM TABLENAME`;

Ex :

SELECT ROUND(PSG_SUBTOTAL/100,2) FROM `partssalesgroup`;

if u needs another thing then, try this also
pls change your field datetype like this COLUMNANE  DECIMAL(2,2)
SELECT CONVERT(Decimal(9,2),variable)
SELECT CONVERT(Decimal(9,2),50000000.00)
To answer this question properly, we really need to know which dbms you are using.
What dbms did that solution work for so it can be added to knowledge base.