Home  >  Article  >  Backend Development  >  php sql 跨表查询,该如何处理

php sql 跨表查询,该如何处理

WBOY
WBOYOriginal
2016-06-13 12:20:341297browse

php sql 跨表查询
表一:u_goods
字段:
id,title, start,site等等
表二:u_tag
id,name
想通过PHP根据表二 字段name 查询出 表一字段title中包含name 的商品
------解决思路----------------------
$sql = "select  a.title,a.start,a.site,b.name  from u_goods as a left join u_tag as b on a.id=b.id where b.name = "XXX"";

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