A
A
Aizharik2015-01-15 11:12:35
MySQL
Aizharik, 2015-01-15 11:12:35

Fetch implementations from MySQL?

Hello!
There are 5 tables with relationships,

Organizations
Users
friends
Messages

fields for Mesages :

id
user_id not null
organization_id
text

if the message is sent from an Organization , then the fields are filled in
user_id - user ID (message sender)
organization_id - organization ID (in which the message was posted)
if the message is sent by User -then the
user_id fields are filled - the user id (sender of the message)
organization_id - will be NULL
I do not know how to get all the messages of a specific user, his friends and organizations in which he is a member.
Of course, you can cycle, but this is not good, tell me where to dig?
8c52e0481afd42b38f1de1db12266e60.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivankomolin, 2015-01-15
@aizhar777

www.mysql.ru/docs/man/UNION.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question