How to display multiple lines in a row with the same identifier in mysql?

advertisements

i have a view in mysql and i want to show two rows with the same id in one row. Please see following pic :

please help me : i want to show expr1 column in one column


Try GROUP_CONCAT:

SELECT POST_ID,TITLE,USERNAME,DATE_TIME,COMMENT_COUNT,GROUP_CONCAT(Expr1) as Expr1
FROM TableName
GROUP BY POST_ID,TITLE,USERNAME,DATE_TIME,COMMENT_COUNT

Result will be:

POST_ID  TITLE         USERNAME   DATE_TIME                 COMMENT_COUNT   Expr1
1        HELLO WORLD   AMIN       2014-01-01 00:00:00.000   0               OS,windows xp