A
A
artmirarmi2018-03-17 13:55:26
MySQL
artmirarmi, 2018-03-17 13:55:26

How to select records from two tables?

Hello.
There is a users table. It has fields id, login, email, etc.
There is one more dialogs table. It contains the fields id, receiver, sender, etc.
I need to select all records from the users table, but on the condition that the dialogs table has a reciver != users.id field and a dialogs.sender != users.id field.
I hope I explained clearly ...
How to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2018-03-17
@VladimirAndreev

Select *
From users u, dialogs d
Where u.id!=d.sender and u.id!=d.receiver

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question