insert into tb_Ref_know2cate
(Category_id,Knowledge_id)
values( '123 ', '234 ')
234=select Category_id from tb_Category where Category_name= 'java '
插入一个表tb_Ref_know2cate 需要取到2个值,假设分别为123,234
其中234的值是由select Category_id from tb_Category where Category_name= 'java ' 得到的.
我的问题是如何把这2个语句写在一起,或者写成一个存储过程.
------解决方案--------------------
insert into tb_Ref_know2cate
(Category_id,Knowledge_id)
select top 1 '123 ', Category_id from tb_Category where Category_name= 'java '
------解决方案--------------------
insert into tb_Ref_know2cate
(Category_id,Knowledge_id)
select '123 ',Category_id from tb_Category where Category_name= 'java '