How can I query using a foreign key in MySQL?

后端 未结 5 1377
暖寄归人
暖寄归人 2020-12-31 03:54

Right now I have a small database with two tables that look something like this:

    users table
    ====================
    id  name   status_id
    1   Bo         


        
5条回答
  •  庸人自扰
    2020-12-31 04:17

    You aren't JOINing here:

    SELECT *
    FROM Users U, Statuses S
    WHERE S.id=U.status_ID
    AND status_id = 2;
    

提交回复
热议问题