数据库
首页 > 数据库> > sql内连查询

sql内连查询

作者:互联网

select <查询的列名> from <表名>

inner join `<连接的表名称>`

on <第一张表的主键> = <第二张表的外键>

--没有先后顺序,下面依次类推,就接着inner join

--条件判断用where

 

select facilities.facilities_name,facilities.facilities_type from fitem

INNER JOIN `fitem`

ON fitem.villa_id = `villa_info`.villa_id

INNER JOIN `facilities`

ON facilities.facilities_id = `fitem`.facilities_id

where villa_info.villa_id=2

标签:villa,查询,facilities,内连,inner,fitem,sql,id,select
来源: https://www.cnblogs.com/zsbb/p/16521048.html