title: How to add comma to numbers in MySQL?
body: <p>Is there a way to get MySQL to return a value with a comma? I have this MySQL query which returns values with 5 digits, for example 14123, but I want it to be 14.123. I read something about the <code>FORMAT()</code> function but I'm not really sure how to use it together with my query, and I want to avoid using PHP.</p>
  
  <p>My query looks like this:</p>
  
  <pre><code>public function artists_count_get()  
      { 
          $this-&gt;load-&gt;database();
          $sql = "SELECT COUNT( DISTINCT artist_id ) AS artists FROM artists";
          $query = $this-&gt;db-&gt;query($sql);
          $data = $query-&gt;result();
  
          if($data) {
              $this-&gt;response($data, 200); 
          } else {
              $this-&gt;response(array('error' =&gt; 'There was an error'), 404);
          }
      }
  </code></pre>