Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I display numeric values with commas

Status
Not open for further replies.

flyboykarl

Technical User
May 17, 2007
1
US
I need to display monetary values with imbedded commas but can't find any info on how to accomplish this. Can someone help? Here is the query I'm executing:

SELECT count(*) "Number of Transfers",
sum(decimal(double(amount),15,2)) "Total Transfer Dollars",
(sum(decimal(double(amount),15,2)))/(count(*)) "Avg Transfer Amount"
FROM TRANSFER_TABLE;
 
flyboykarl,
Where are you running this sql (Mainframe, Windows etc.) and to what is the result being returned (DB2 command centre, QMF, Access etc.)?

I think that this formatting is usually handled by the environment or language. The excellent DB2 cookbook by Graeme Birchall describes a method of doing this on page 374, by writing a user defined function to convert the decimal output to character. This may be a method you could use if your resultant environment is unable to format the way you wish.

Hope this helps.

Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top