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

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -