I have three tables in the database.
The first table is one that contains user information and that looks like this:
id | name | status
---------------------------------------
1 | john | 1
2 | helen | 1
3 | mike | 1
4 | tina | 1
5 | jim | 0
6 | nina | 1
The second table contains registered users for a certain service:
sid | status
------------------------
1 | 1
2 | 1
The third table contains registered users for another service:
oid | status
------------------------
3 | 1
4 | 1
I have to make a request that will find all users with the status “1” from the second and third tables, and then get the name and identifier of all these users from the first table (with information about users). The result from this example will look like this:
id | name | status
---------------------------------------
1 | john | 1
2 | helen | 1
3 | mike | 1
4 | tina | 1
What will this query look like? Should I use an INNER JOIN?
source
share