MySQL + PHP: fetching data using foreign keys

后端 未结 4 1805
一整个雨季
一整个雨季 2021-01-14 08:21

I have 2 tables (Users, Wall). The UserID in the Wall table is a foreign key. How would I go about fetching the users details using this? (I want to fetch the users Forename

4条回答
  •  Happy的楠姐
    2021-01-14 09:01

    Or in an alternative form:

    SELECT w.*, u.Forename, u.Surname
    FROM Wall w, Users u
    WHERE w.UserID=u.UserID
    

提交回复
热议问题