ใช้ FORMAT(number, decimals) เพื่อใส่คอมม่าคั่นกลุ่มหลักพัน
ตัวอย่าง
mysql> create table DemoTable ( Value BIGINT ); Query OK, 0 rows affected (0.74 sec)
mysql> insert into DemoTable values(78000000000); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(10000000000); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(90000000000); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(450600000000); Query OK, 1 row affected (0.41 sec)
จัดรูปแบบ
mysql> select format(Value,0) as `FormatValue` from DemoTable;
+-----------------+ | FormatValue | +-----------------+ | 78,000,000,000 | | 10,000,000,000 | | 90,000,000,000 | | 450,600,000,000 | +-----------------+
พารามิเตอร์ที่ 2 คือจำนวนทศนิยม ใช้ 0 สำหรับจำนวนเต็ม