mysql - Group values of a column by comma without using GROUP_CONCAT -


i have table data below in mysql:

id   name  1    john  1    jack  2    ankit 

i need following output:

id   name  1    john,jack  2    ankit 

i know can using group_concat but, need above output without using group_concat.

please me on this.

crazy answer crazy question !

select id, max(name) ( select  if(@previd <>  id,  @name := null,  @name := @name),  (if(@name null, @name := name, @name := concat(@name, ', ', name))) name, id, @previd := id mytable,  (select  @name := null, @previd  := 0) s order id ) d group id  

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -