title: MySQL-how can use count(*) for column data after splitting values with if statement in sql query?
body: <p>My sql query is like below.</p>
  
  <p><code>select if(name like 'ram%',if(place = 'Chennai','ramChennai','ramUnknown'),name) as name,
  count(*) as OwnerCount from detail where dept='CSE' group by name</code></p>
  
  <p>This query is splitting the name but counting is not happening correctly.
  It is counting by old <code>name</code> <code>ram</code> and <code>raman</code> and not by <code>ramChennai</code> and <code>ramUnknown</code></p>
  
  <p>Is there any better way to count after splitting the column values?</p>