ID Column1 Column2 Column3
1 data1 data3
1 data2
from table above, may I perform a single query to get this? :
ID Column1 Col开发者_如何学Cumn2 Column3
1 data1 data2 data3
SELECT
MAX(Column1) AS Column1,
MAX(Column2) AS Column2,
MAX(Column3) AS Column3
FROM
table
GROUP BY
ID
SELECT
GROUP_CONCAT(Column1) AS Column1,
GROUP_CONCAT(Column2) AS Column2,
GROUP_CONCAT(Column3) AS Column3
FROM table
GROUP BY ID
精彩评论