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

WBOY
Release: 2016-06-13 10:33:43
Original
1068 people have browsed it

php查询mysql多个表字段

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

我想在查询中添加查询表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>
Copy after login
探讨

逗号为英文状态:
SQL code

SELECT t1.id,channel,title,t2.name,t2.tel FROM teble1 as t1, table2 as t2 WHERE t1.id='$id'
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!