mysql - query three tables

后端 未结 5 1430
庸人自扰
庸人自扰 2021-01-22 19:06

I have a relational database with three tables. The first containts id\'s that relate to the second. The second contains id\'s that relate to the third. The third contains the r

5条回答
  •  太阳男子
    2021-01-22 20:02

    Mysql Join

    Try this

    select * from table1 t1
    join table2 t2 on t1.t2ref = t2.id
    join table3 t3 on t2.t3ref = t3.id
    

    Add a where clause to search for certain rows in table1

    where t1.field = 'value'
    

提交回复
热议问题