您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 哈密分类信息网,免费分类信息发布

mysql 如何把查询到的结果插入到另一个表中

2025/2/10 2:25:03发布8次查看
mysql查询插入新表
首先我们在goods表中查询
select goods_id from ecs_goods where goods_name = '23423423' limit 1
查询goods_name对应的goods_id的值
然后把查询到的goods_id的值作为参数,
insert into ecs_comment (comment_id, comment_type, id_value, email, user_name, content, comment_rank, add_time, ip_address, status, parent_id, user_id) values (null, '0', 'goods_id', 'asdas', 'asdas', '23324324', '0', '2015-04-05 19:55:05', '', '1', '0', '0');
插入到另一个表中的新记录里
插入语句中的goods_id的值就是上面查询语句中的goods_id的值
哈密分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录