sql server - How to simplyfy this sql query? -


update room set selected = 1 room_id =  (select room_id room_rev rev_id =  (select rev_id room_rev room_id = 'rom0001' , (start_date<='2015-03-20' , end_date>'2015-03-20'))) 

can me simplify query?

i want select many room_id room_rev same rev_id room_id = 'rom0001', room_id use update selected room , room_rev 1 many relationship

you can use join like:

update r set r.selected = 1 room r  inner join room_rev rr on r.room_id = rr.room_id rr.room_id = 'rom0001' , (rr.start_date<='2015-03-20' , rr.end_date>'2015-03-20') 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -