2011-03-09 69 views
0

表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) 

怎麼樣?好心幫我..

+0

究竟什麼是你的問題? – 2011-03-09 01:25:56

+2

這不會破壞標準化嗎? – 2011-03-09 01:29:41

回答

1

試試這個:

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

謝謝soo – apssiva 2011-03-14 09:02:44