Advertisement
roma2341

find chat user rooms stored procedure

Dec 10th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.34 KB | None | 0 0
  1. drop procedure if exists find_chat_user_rooms;
  2.  
  3. DELIMITER //
  4.  
  5. CREATE PROCEDURE find_chat_user_rooms(IN chat_user_id INT(10))
  6.   BEGIN
  7.     SELECT id FROM chat_room WHERE author_id = chat_user_id
  8.     UNION SELECT rooms_from_users_id FROM chat_room_users WHERE users_id = chat_user_id;
  9.   END;
  10.  
  11. DELIMITER ;
  12.  
  13. CALL find_chat_user_rooms(583);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement