mysql

[스크랩] ▣ [MySQL] 숫자에 콤마찍어 보기

네모세모네모 2012. 5. 9. 17:59
SELECT FORMAT(amount,0) FROM collection


FORMAT( 숫자항목명,  소수이하표시자리수)


FORMAT(X,D)
Formats the number X to a format like '#,###,###.##', rounded to D decimals. If D is 0, the result will have no decimal point or fractional part:

mysql> SELECT FORMAT(12332.123456, 4);
       -> '12,332.1235'
mysql> SELECT FORMAT(12332.1,4);
       -> '12,332.1000'
mysql> SELECT FORMAT(12332.2,0);
       -> '12,332'

출처 : SQL with neXPice
글쓴이 : database 원글보기
메모 :