【发布时间】:2017-03-14 05:14:40
【问题描述】:
这是我的代码:
SELECT all_university.*,
all_colleges.*
FROM all_university
INNER JOIN all_colleges ON all_colleges.stateid = all_university.stateid
WHERE courses LIKE '%BTech%'
这里我想要来自all_university 和all_colleges 的所有数据,其中stateid 在两个表中都很常见,但是当我运行查询时,where 条件会引发错误
#1052 - Column 'courses' in where clause is ambiguous. How can I remove this.
谢谢
【问题讨论】:
-
是的,两张桌子上都有课程。
-
使用别名来区分。
all_colleges.courses -
对通用名称字段使用别名
-
选择 all_university 。 * , all_colleges 。 * FROM all_university as au INNER JOIN all_colleges ON all_colleges.stateid = au.stateid where course like '%BTech%'
-
它显示错误 #1051 - 未知表 'all_university'
标签: javascript php jquery html mysqli