注册 登录
编程论坛 SQL Server论坛

insert into问题

yunj1105 发布于 2007-04-06 10:55, 510 次点击
insert into lab_stu_course select Cou_num,Cou_name,Cou_flag,Cou_period from lab_course where Cou_ID=123
如果还要往表lab_stu_course中加一项user_ID(在表lab_stu_course中为not null)但这一项不在表lab_course中
要怎么写啊?
2 回复
#2
Kendy1234562007-04-06 12:21
insert into lab_stu_course (num,name,flag,period,user_ID)
select Cou_num,Cou_name,Cou_flag,Cou_period,b.UserID from lab_course a
join table1 b on ....
where Cou_ID=123
#3
yunj11052007-04-06 13:40
谢谢
1