query syntax

All,

How can i make 5000.000000 look like 50.00 using a sql statement?
MoreThanDoubledAsked:
Who is Participating?
 
SharathData EngineerCommented:
convert(decimal(10,2),5000.000000/100)
0
 
SaboraCommented:
select ROUND(5000.00000 / 100, 2)
0
 
MoreThanDoubledAuthor Commented:
Sabora, this is close but i get 50.000000000 i want 50.00
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
SaboraCommented:
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?
0
 
kumaresan2011Commented:
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)
0
 
coldchillinCommented:
SELECT CONVERT(Decimal(9,2),variable)
SELECT CONVERT(Decimal(9,2),50000000.00)
0
 
awking00Commented:
To answer this question properly, we really need to know which dbms you are using.
0
 
awking00Commented:
What dbms did that solution work for so it can be added to knowledge base.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.