首页  >  文章  >  后端开发  >  php查询mysql多个表字段解决方法

php查询mysql多个表字段解决方法

WBOY
WBOY原创
2016-06-13 10:33:431117浏览

php查询mysql多个表字段

SQL code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->SELECT id,channel,title FROM teble1 WHERE id='$id'

我想在查询中添加查询表table2,查询字段为:name,tel应该怎么写?

------解决方案--------------------
逗号为英文状态:
SQL code
SELECT t1.id,channel,title,t2.name,t2.tel FROM teble1 as t1, table2 as t2 WHERE t1.id='$id'<br><font color="#e78608">------解决方案--------------------</font><br>
探讨

逗号为英文状态:
SQL code

SELECT t1.id,channel,title,t2.name,t2.tel FROM teble1 as t1, table2 as t2 WHERE t1.id='$id'
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn