php - Chat Application Database Query and Design -


this database scheme query below.

this scenario confuses me. when login user_id = 1 , create conversation , receiver user_id = 4 query below works.. because query retrieve conversations based on sender. when log in user_id = 4 can't see conversation because i'm receiver , don't want create conversation i'm sender , receiver user_id = 1 because conversation started user_id = 1. can me query?

change inner join include receiver well, so

inner join conversations on (userprofiles.user_id = userprofiles.receiver_id or userprofiles.user_id = sender_id) 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -