Receive value from one table by an ID from another table

Advertisements

I have 2 tables: users, requests
The table users contains: id, name, email….

The table requests contains: id, id_user, date…..

How can I use the column id_user to get the name of the user from the table users?

So I want to get the name with the id_user from table users.

>Solution :

select requests.id_user ,
             users.name 
from users 
join requests on users.id = requests.id_user 

Leave a ReplyCancel reply