sql - How to add comma to numbers in MySQL? -


this question has answer here:

is there way mysql return value comma? have mysql query returns values 5 digits, example 14123, want 14.123. read format() function i'm not sure how use query, , want avoid using php.

my query looks this:

public function artists_count_get()       {          $this->load->database();         $sql = "select count( distinct artist_id ) artists artists";         $query = $this->db->query($sql);         $data = $query->result();          if($data) {             $this->response($data, 200);          } else {             $this->response(array('error' => 'there error'), 404);         }     } 

try this:

$sql = "select format(count( distinct artist_id ),0) artists artists"; 

more info using format: mysql format


Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -