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

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -