There are three tables such as persons, emails, phones.
persons
+----+-----------+-----+ | id | firstname | age | +----+-----------+-----+ | 1 | Катя | 12 | | 2 | Лена | 18 | +----+-----------+-----+ +----+-----------+-----------+ | id | email | person_id | +----+-----------+-----------+ | 1 | wer@sdf.ru| 1 | | 2 | | 2 | +----+-----------+-----------+ telephone
+----+-----------+-----------+ | id | phone | person_id | +----+-----------+-----------+ | 1 | 3423434324| 1 | | 2 | | 2 | +----+-----------+-----------+ I make a request
SELECT * FROM persons p INNER JOIN phones ph ON p.id = ph.person_id INNER JOIN emails e ON p.id = e.person_id` In such cases, only Katya gets to the table on the site. Because she has both an email and a phone. How can I make a request for Lena to be in the table?
GROUP BY some_fieldin your case by theperson_idfield. Well, either there is no data in the tables for Lena - BOPOH