如何加入两个表并更新表?

时间:2011-03-09 01:24:14

标签: phpmyadmin

表1:

id,studname,course

1,AAA,EnglishI
1,AAA,Basic programming 
1,AAA,EnglishII
1,AAA,Maths
2,BBB,programming
2,BBB,IT Essential
2,BBB,Maths

表2:

1,AAA,(EnglishI,Basic programming,EnglishII,Maths)-serialization
2,BBB,(programming, IT Essential, Maths)

如何?请帮助我..

1 个答案:

答案 0 :(得分:1)

试试这个:

SELECT id, studname, GROUP_CONCAT(course) FROM table GROUP BY studname