Home >Backend Development >PHP Tutorial >mysql 3个表查询。

mysql 3个表查询。

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-20 12:44:021054browse

第一个表



第二个表



第三个表




第一个第二个表中的id与第三个表中的fid是关联的。 我想根据第三个表中的fid查询出第一表中的title, description,cover_id  与第二个表中的peice , isbn ,publisher。请问这要怎么写?我有用join查询写过,可是只查询出了一半的结果。


回复讨论(解决方案)

select * from 表三 a left join 表一 b on a.fid=b.id left join 表二 c on a.fit=c.id where a.fid=$fid

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:有人知道微信相册么Next article:PHP 代码加密