SHARE
TWEET

Untitled

a guest Jan 12th, 2017 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. UPDATE "Order"
  2. SET room_number=(SELECT "Room".room_number
  3.                  FROM public."Room"
  4.                  WHERE "Room".room_number=cast(? AS INT)),
  5. status_id=(SELECT "Order_status".status_id
  6.            FROM public."Order_status"
  7.            WHERE "Order_status".order_status_en='confirmed'),
  8. full_cost=coalesce((((SELECT "Order".check_out
  9.                       FROM public."Order"
  10.                       WHERE "Order".order_id=cast(? AS INT)) -
  11.  
  12.                      (SELECT "Order".check_in
  13.                       FROM public."Order"
  14.                       WHERE "Order".order_id=cast(? AS INT))) *
  15.  
  16.                      (SELECT "Room".room_price
  17.                       FROM public."Room"
  18.                       WHERE "Room".room_number=cast(? AS INT))), full_cost)
  19. WHERE exists(SELECT 1 FROM public."Room" WHERE "Room".room_number=cast(? AS INT))
  20. AND "Order".order_id=cast(? AS INT) AND "Order".status_id=(SELECT "Order_status".status_id
  21.                                                            FROM public."Order_status"
  22.                                                            WHERE "Order_status".order_status_en='unconfirmed');
RAW Paste Data
Top