update c set c.isreserve = (case when a.reserve_time>getdate() and a.arrive_time isnull and a.iscancel=0 then 1 else 0 end),
c.istaboo = (case when b.end_time > getdate() then 1 else 0 end)
from room c
left join reserve a on a.room_id = c.room_id
left join taboo b on b.room_id = c.room_id

解决方案 »

  1.   

    update room set isreserve=case when exists(select 1 from reserve where reserve_time>getdate() and arrive_time is null and iscancel=0) then 1 else 0 end,
    istaboo=case when exists(select 1 from taboo where end_time>getdate()) then 1 else 0 end??
      

  2.   

    update room set isreserve=... ,istaboo=... where exists (select room_id from  reserve t1 where t1.room_id=room.room_id and t1.reserve_time>getdate() and t1.arrive_time isnull and  iscancel=0) and exists(select room_id from taboo t2 where t2.room_id=room.room_id and  t2.end_time>getdate())
      

  3.   

    update room set isreserve=case when exists(select 1 from reserve where reserve_time>getdate() and arrive_time is null and iscancel=0 and reserve.room_id=room.room_id) then 1 else 0 end,
    istaboo=case when exists(select 1 from taboo where end_time>getdate() and taboo.room_id=room.room_id) then 1 else 0 end
      

  4.   

    在表中设置关联就可以了,我想用join这么多的表吧