这个sql 错在哪呀

来源:百度知道 编辑:UC知道 时间:2024/05/20 20:52:33
create trigger insertuser on [user] for insert as
begin
insert into gongre (houseid) values(select houseid from inserted)
insert into wuye (houseid) values (select houseid from inserted)
end

错误提示
消息 156,级别 15,状态 1,过程 insertuser,第 3 行
关键字 'select' 附近有语法错误。
消息 102,级别 15,状态 1,过程 insertuser,第 3 行
')' 附近有语法错误。
消息 156,级别 15,状态 1,过程 insertuser,第 4 行
关键字 'select' 附近有语法错误。
消息 102,级别 15,状态 1,过程 insertuser,第 4 行
')' 附近有语法错误。

很少用这样的查询语句 ...

不能 select 出一个值来再 insert 么 ..?

还少一次查询 ...

values后面不能用select
可以用insert into 表名(列名) select 列名 from 表名 这样直接写,插入多条记录.

乱了套的语句