I can’t seem to figure out to make join statements.
select usrs.*
from
students s
join system_users usrs on
s.father=usrs.user_id
OR s.mother=usrs.user_id
OR s.guardian=usrs.user_id
where s.user_id = '201209083'
I have this query, and it returns :
+------------+---------+--------+--------+
| user_id | contact | status | rights |
+------------+---------+--------+--------+
| f201209083 | 4093 | active | NULL |
| g201209083 | 4095 | active | NULL |
| m201209083 | 4094 | active | NULL |
+------------+---------+--------+--------+
Now what I need is to use the information of the contact column to retrieve more information and join it with this table:
select
*
from
address
where
contact_id = (contact column);
I need help with implementing it in one query.
P.S. Can someone tell me what this technique is called? I cannot find information on this by just searching for JOINs. Or a link to learn would be even better.
You could take that current statement as a sub-query and join it as such:
That should give you the original results combined with the results from the
addresstable.