sql - Build a Query to get the informations from a specific user -
i'm building chat 3 tables.
conversation, conversation_reply , user
conversation columns
- id
- user_one
- user_two
conversation_reply columns
- id
- user_id
- conversation.id
- reply
user columns
- id
- username
i build list name users chating specific user.
example, id 711, , talking 3 persons, username 3 persons.
i'm having issues building query because user_one , user_two relative, id receiver can inserted user_one, or user_two. depends on user starts chatting first.
how can build query that?
thanks.
depending on rdbms can check if/else, case/when syntax. based on write statement:
select if (user_one=711) user_two else user_one conversation user_one=711 or user_two=711
this pseudocode, idea should clear.
Comments
Post a Comment