我有声明
update Clients
set StatusID= 4
from (select c.clientid
from Clients c
where CategCode = 'CH' and StatusID in (1,2,6) and DATEDIFF(YEAR,dob,GETDATE())>5)
它给我带来了错误
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near ')'.
你知道什么会导致这个错误吗?
我试图使用这个语句,但它为所有客户端设置了状态 4
update Clients
set StatusID= 4
WHERE EXISTS(
select clientid,DOB,DATEDIFF(YEAR,dob,GETDATE())
from Clients
where CategCode = 'CH' and StatusID in (1,2,6) and DATEDIFF(YEAR,dob,GETDATE())>5