Use ordering in group_concat mysql function
SELECT group_concat(couloumname order by couloumname) AS views
FROM tablename GROUP BY couloumname
you should use different order by condition for the multiple group_concat condition
below is the example of using the multiple group_concat with order by condition
SELECT group_concat(couloumname1 order by couloumname1) AS views
, group_concat(couloumname2 order by couloumname2) AS views2
FROM tablename GROUP BY couloumname
you should also use the seperator if you want to change the comma seperated value from the select query
SELECT group_concat(couloumname1 order by couloumname1 desc SEPARATOR ' ') AS views
, group_concat(couloumname2 order by couloumname2) AS views2
FROM tablename GROUP BY couloumname
FROM tablename GROUP BY couloumname
you should use different order by condition for the multiple group_concat condition
below is the example of using the multiple group_concat with order by condition
SELECT group_concat(couloumname1 order by couloumname1) AS views
, group_concat(couloumname2 order by couloumname2) AS views2
FROM tablename GROUP BY couloumname
you should also use the seperator if you want to change the comma seperated value from the select query
SELECT group_concat(couloumname1 order by couloumname1 desc SEPARATOR ' ') AS views
, group_concat(couloumname2 order by couloumname2) AS views2
FROM tablename GROUP BY couloumname
Comments
Post a Comment