MySQL数据库中每个字段的多个值

  • First of all: I know that its really bad style to work with multiple entries in one field, but I did not create the database myself and now I have to work with it. It has around 20000 entries and I really dont want to change it at the moment.
  • The table A I'm talking about has a column with some ID's, e.G.: ,282,3358,123,
  • Those ID's are matching with the primary keys of some other table B. B has another column name.
  • I want to get those names into my table A replacing those ID's
  • Example:

Table B

| ID |      name         |     
+----+-------------------+
|282 |      name_1       |
+----+-------------------+
|3358|      name_2       |
+----+-------------------+
|123 |      name_3       |

Initial Situation TABLE A

 ... |         ID             | ...    
-----+------------------------+-----
 ... |    ,282,3358,123,      | ... 

Desired Result for TABLE A

 ... |         ID             | ...    
-----+------------------------+-----
 ... | ,name_1,name_2,name_3, | ...  
查看全部
duangou1551
duangou1551
2013/11/28 14:52
  • php
  • mysql
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复