<分区>
有没有办法让MySQL返回一个带逗号的值?我有这个 MySQL 查询,它返回 5 位数字的值,例如 14123,但我希望它是 14.123。我阅读了一些关于 FORMAT()
函数的内容,但我不太确定如何将它与我的查询一起使用,我想避免使用 PHP。
我的查询是这样的:
public function artists_count_get()
{
$this->load->database();
$sql = "SELECT COUNT( DISTINCT artist_id ) AS artists FROM artists";
$query = $this->db->query($sql);
$data = $query->result();
if($data) {
$this->response($data, 200);
} else {
$this->response(array('error' => 'There was an error'), 404);
}
}