34,588
社区成员
发帖
与我相关
我的任务
分享
SQL codeselect id from bookid where bookname="书的名字"
SQL codeupdate content set bookid='书的ID' where bookname="书的名字"
SQL codeupdate content set bookid=(select id from bookid where bookname="书的名字") where bookname="书的名字"
update content set bookid=(select TOP 1 id from bookid where bookname="书的名字") where bookname="书的名字"
update content set bookid='书的ID' where bookname = (select id from bookid where bookname = "书的名字")
update content set bookid=bookid.id from content a,bookid b on content.bookid=bookid.id
where content.bookname='满天星'
update content set bookid=b.id from content a,bookid b on a.bookid=b.id
where a.bookname='书的名字'
一,根据书的名字取得书的ID
select id from bookid where bookname="书的名字"
二,根据刚刚取得的 书的ID ,在第二张表中更新书的内容:
update content set bookid='书的ID' where bookname="书的名字"
------------------------------------------
update content set bookid=b.id from content a,bookid b
where a.bookname=b.bookname and a.bookname='书的名字'
1===========
declare @bookid int
select @bookid = id from bookid where bookname='书的名字'
codeupdate content set bookid = @bookid where bookname='书的名字'
2====
update t
set t.bookid= b.id
from content t
left join bookid b on t.bookname = b.bookname
where t.bookname='书的名字'