给出两个创建并填充的表,如下所示:
CREATE TABLE dbo.envelope(id int, user_id int);
CREATE TABLE dbo.docs(idnum int, pageseq int, doctext varchar(100));
INSERT INTO dbo.envelope VALUES
(1,1),
(2,2),
(3,3);
INSERT INTO dbo.docs(idnum,pageseq) VALUES
(1,5),
(2,6),
(null,0);
以下查询的结果是什么?
UPDATE docs SET doctext=pageseq FROM docs INNER JOIN envelope ON envelope.id=docs.idnum
WHERE EXISTS (
SELECT 1 FROM dbo.docs
WHERE id=envelope.id
);
答案 0 :(得分:0)
您需要此: 它的...只是运行并查看结果
select * from dbo.docs
答案 1 :(得分:0)
如果idnum
表中存在envelope
,则UPDATE
命令将更新doctext
表中的doctext=pageseq
(设置docs
)列