Answer the question
In order to leave comments, you need to log in
How to make table joins in SQL not "hard"?
Good evening everyone! Faced a problem: there are 3 tables: dle_users, dle_usergroups and dle_social_login.
Data is written to the dle_social_login table when authorizing on the site through social networking applications. The match occurs via the dle_social_login.id = dle_users.user_id column.
The problem is that the SQL query only returns those rows that have entries in the "id" column in the "dle_social_login" table.
For example, a user with id = 3 logged in using the classic email/password method -> this user's data will not be included in dle_social_login -> the request does not display this user. And you need to take it out.
SELECT
dle_users.user_id,
dle_users.email,
dle_usergroups.group_name,
dle_social_login.provider
FROM dle_users
INNER JOIN dle_usergroups
ON dle_users.user_group = dle_usergroups.id
INNER JOIN dle_social_login
ON dle_users.user_id = dle_social_login.id
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question