Heim  >  Artikel  >  Backend-Entwicklung  >  php查询mysql多个表字段解决方法

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

WBOY
WBOYOriginal
2016-06-13 13:23:351066Durchsuche

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'
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel: 给PHP装配amqp扩展 Nächster Artikel: PHP错误详解