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

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -