使用mysql数据库进行左右连接查询的时候出现错误提示 Column 'id' in where clause is ambiguous
2018-02-02 18:26
751 查看
使用mysql数据库进行左右连接查询的时候出现错误提示 Column 'id' in where clause is ambiguous。
这个错误in where clause is ambiguous多半是因为多表查询的时候几个表中同时出现了某个相同的列名,而在查询条件WHERE后面又没有指定是那个表,而引起的
又或者是查询结果里面有两个相同的列名,而没有指定是哪个表使用的时候可以这样,mysql查询前面加表名可避免出现错误Column 'id' in where clause is ambiguous
$sql = "select * from (store as a right join area as c on a.area_id=c.id) left join `group` as
b on a.id=b.store_id where a.area_id=88";
where 条件语句后查询某个字段要加上表名
这个错误in where clause is ambiguous多半是因为多表查询的时候几个表中同时出现了某个相同的列名,而在查询条件WHERE后面又没有指定是那个表,而引起的
又或者是查询结果里面有两个相同的列名,而没有指定是哪个表使用的时候可以这样,mysql查询前面加表名可避免出现错误Column 'id' in where clause is ambiguous
$sql = "select * from (store as a right join area as c on a.area_id=c.id) left join `group` as
b on a.id=b.store_id where a.area_id=88";
where 条件语句后查询某个字段要加上表名
相关文章推荐
- MySQLIntegrityConstraintViolationException: Column 'ID' in where clause is ambiguous
- 错误代码: 1052 Column 'sys_date' in where clause is ambiguous
- Column 'id' in where clause is ambiguous
- 错误信息:Column 'SalesMarketID' in where clause is ambiguous
- Integrity constraint violation: 1052 Column "order_id" in where clause is ambiguous
- MySQLIntegrityConstraintViolationException: Column 'ID' in where clause is ambiguous
- MySQLIntegrityConstraintViolationException: Column 'ID' in where clause is ambiguous
- Column 'id' in where clause is ambiguous
- Column 'id' in where clause is ambiguous
- MySQLIntegrityConstraintViolationException: Column 'ID' in where clause is ambiguous
- MySQLIntegrityConstraintViolationException: Column 'ID' in where clause is ambiguous ;
- Column 'id' in where clause is ambiguous
- Integrity constraint violation: 1052 Column 'user_id' in where clause is ambiguous
- Column 'id' in where clause is ambiguous
- 错误代码: 1052 Column 'sys_date' in where clause is ambiguous
- Column 'is_valid' in where clause is ambiguous
- column 'typeid' in where clause is ambiguous
- Mybatis框架不同命名空间相同查询id出现queryById is ambiguous in Mapped Statements collection
- mysql Error:1052 Column 'xxx' in where clause is ambiguous
- tomcat 报Column 'del_flag' in where clause is ambiguous