Willy Laurents Willy Laurents - 1 month ago 8
SQL Question

how can i get record in another table (SQL)

i have 2 tables

table1 :

----------------------------------------
| id | request_id | user_id | mitra_id |
----------------------------------------


table2:

-------------------------
| mitra_id | mitra_name |
-------------------------


how can i get mitra_name using mitra_id in table1?

Answer
SELECT tab1.*
     , tab2.mitra_name
FROM table1 tab1
INNER JOIN table2 tab2
  ON tab2.mitra_id = tab1.mitra_id;

To learn some superbasic SQL:

W3Schools intro to SQL

W3Schools INNER JOIN lesson