Donate

Format Query Result By Count() With Comma Using Format() In MySQL Database

I played around with MySQL count() statement. I found it annoying that the count()
will simply return whole numbers. Example: the total record of a table is 32,272.
In MySQL SQL, this will simply return 32272. Below are two sql scripts. The first
one returns whole number,while the second query returns comma separated number.

ENJOY!!!!
  select count(*) as num_records_notformatted from mytable where name like '%j%';  
  Solution:  
  select format(count(id),0) as num_records_formatted from mytable   
  where name like '%j%';  

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Pass GUID As Parameter To Action Using ASP.NET MVC ContribGrid