当前位置:Gxlcms > PHP教程 > php查询mysql多个表字段解决方法

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

时间:2021-07-01 10:21:17 帮助过:18人阅读

php查询mysql多个表字段
SQL code
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'

------解决方案--------------------
探讨

逗号为英文状态:
SQL code

SELECT t1.id,channel,title,t2.name,t2.tel FROM teble1 as t1, table2 as t2 WHERE t1.id='$id'

人气教程排行