0

I want to calculate etr_meet % of name in mysql. How to calculate etr_meet (yes).

name          etr_meet 

Anup          yes
Anup          no
Hari          yes
Hari          yes
Shyam         yes
Shyam         yes
Sudip         yes
Sudip         no
Sudip         no
Blank
  • 12,308
  • 1
  • 14
  • 32
T.r.
  • 55
  • 1
  • 1
  • 6
  • 1
    Possible duplicate of [Format number as percent in MS SQL Server](http://stackoverflow.com/questions/30089490/format-number-as-percent-in-ms-sql-server) – buræquete Feb 27 '17 at 06:55

1 Answers1

0

If you want to query yes percent in every name group, try this:

select
    name,
    concat(count(case when etr_meet = 'yes' then 1 else null end) * 100 / count(1), '%')
from yourtable
group by name
Blank
  • 12,308
  • 1
  • 14
  • 32