Hello buddies , I have no Idea what is subquery, every time I tried to link two tables in one sql query I failed
here is the scenario I want:
in this pic I have posts with "user_id" only I need to show the username which stored on another tables called users
I've tried using but its not working.
$sq= "SELECT user_id, username FROM users WHERE user_id IN (SELECT user_id FROM posts WHERE user_id= '".$id."')";
posts table
this is the users tables