Apply GROUP_CONCAT and CONCAT on a integer type value


As we know GROUP_CONCAT returns a string result with the concatenated non-NULL values from a group and CONCAT Returns the string that results from concatenating the arguments.

If we apply these function on any not char type field then it will be return result something like [BLOG-3B] and something like this. So to apply on non chars field like int type we can use CONVERT mysql function for it.

For example

SELECT concat(CONVERT(column1,char(8))," , ") AS id,group_concat(CONVERT(column2, CHAR(20)) separator '|') AS result FROM `tablename` WHERE 1 group by column1

Here CONVERT will convert value of field column1 into a char type. and CONVERT function will be work on it.