?
Solved

query syntax

Posted on 2011-05-12
8
Medium Priority
?
234 Views
Last Modified: 2012-05-11
All,

How can i make 5000.000000 look like 50.00 using a sql statement?
0
Comment
Question by:MoreThanDoubled
8 Comments
 
LVL 1

Expert Comment

by:Sabora
ID: 35747762
select ROUND(5000.00000 / 100, 2)
0
 

Author Comment

by:MoreThanDoubled
ID: 35747829
Sabora, this is close but i get 50.000000000 i want 50.00
0
 
LVL 41

Accepted Solution

by:
Sharath earned 2000 total points
ID: 35747943
convert(decimal(10,2),5000.000000/100)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Expert Comment

by:Sabora
ID: 35747952
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
 
LVL 5

Expert Comment

by:kumaresan2011
ID: 35748041
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
 
LVL 1

Expert Comment

by:coldchillin
ID: 35748085
SELECT CONVERT(Decimal(9,2),variable)
SELECT CONVERT(Decimal(9,2),50000000.00)
0
 
LVL 32

Expert Comment

by:awking00
ID: 35754461
To answer this question properly, we really need to know which dbms you are using.
0
 
LVL 32

Expert Comment

by:awking00
ID: 35756361
What dbms did that solution work for so it can be added to knowledge base.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

839 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