请问怎么通过$a将张三和李四的id同时写入到表B的a_id
表A
id name
1 张三
2 李四
$a=‘张三,李四’
请问怎么通过$a将张三和李四的id同时写入到表B的a_id
即:
表B
id a_id
1 1,2
------解决思路----------------------
本帖最后由 xuzuning 于 2014-11-29 11:41:45 编辑
insert into 表B (a_id) select group_concat(id) from A表 where find_in_set(name, '$a')
------解决思路----------------------update 表B set a_id=(select group_concat(id) from 表a where find_in_set(name, '$a'))
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn