How can I query using a foreign key in MySQL?

后端 未结 5 1349
暖寄归人
暖寄归人 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:27

    SELECT u.*, s.*
    FROM users u
        inner join statuses s on u.status_id = s.id
    WHERE u.status_id = 2
    

提交回复
热议问题