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的值