--记录表
create table RecordInfo
(
recordId int primary key identity(1,1),
recordType int references DictionaryInfo(dictionaryId),
userId int references UserInfo(userId),
status bit,
recordTime datetime
)
go--集合表
create table ListInfo
(
listId int primary key identity(1,1),
recordId int references RecordInfo(recordId),
bookId int references BookInfo(bookId) ,
)上面是两张表recordId是两张表的连接条件,及外键关系,我是想用ListInfo中的listId来修改RecordInfo中的status值,不知道怎么实现,希望大家帮忙,把sql语句写一下,谢谢。
create table RecordInfo
(
recordId int primary key identity(1,1),
recordType int references DictionaryInfo(dictionaryId),
userId int references UserInfo(userId),
status bit,
recordTime datetime
)
go--集合表
create table ListInfo
(
listId int primary key identity(1,1),
recordId int references RecordInfo(recordId),
bookId int references BookInfo(bookId) ,
)上面是两张表recordId是两张表的连接条件,及外键关系,我是想用ListInfo中的listId来修改RecordInfo中的status值,不知道怎么实现,希望大家帮忙,把sql语句写一下,谢谢。
update RecordInfo
set status = n.listId
from RecordInfo m , ListInfo n
where m.recordId = n.recordId
from RecordInfo m, ListInfo n
where m.recordId = n.recordId and n.listId=1