mysql Error:1052 Column 'xxx' in where clause is ambiguous

Integrity constraint violation: 1052 Column ‘deleted‘ in where clause is ambiguous

MySQL查询的时候出现这个错误提示多半是因为:

1.多表查询的时候几个表中同时出现了某个相同的列名,而在查询条件WHERE后面又没有指定是那个表。

2.查询结果里面有两个相同的列名,而没有指定是哪个表。

比我我的原因就是查询两张表,每个表都有创建时间,但查询不知到加上哪涨,所以需要重新定位

mysql Error:1052 Column 'xxx' in where clause is ambiguous

原文地址:https://www.cnblogs.com/toufajiantuzhongbuhui/p/12606930.html

时间: 2024-08-02 19:45:22

mysql Error:1052 Column 'xxx' in where clause is ambiguous的相关文章

Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous

public function roleManage($search,$tpage,$num) { //查询一个角色所对应的多个用户,联表查询 $result=Db::name('role') ->field('r.rid,r.rolename,u.username') ->alias('r') ->join('user u','u.rid=r.rid','') ->where($search) ->select(); //数据总条数 $count=Db::name('rol

Error: ER_BAD_FIELD_ERROR: Unknown column 'xxx' in 'where clause'

node中调用mysql模块读写时候,如果直接插入字符串: connection.query('SELECT * from  users WHERE name=' + data.name , callback); 或者: connection.query('SELECT * from  users WHERE name = alan' , callback); 会抛出这个错误. 正确写法应该是: connection.query("SELECT * from  users WHERE name=

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'org_mer_id' in where clause is ambiguous

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'org_mer_id' in where clause is ambiguous ### The error may exist in class path resource [mapper/StatisticsPeriodTaskMapper.xml] ##

mysql出现 Unknown column 'bname' in 'where clause'和Unknown column 'bid' in 'field list'

在用mysql数据库建表和修改数据库数据时,出现  Unknown column 'bname' in 'where clause'和Unknown column 'bid' in 'field list'. 除了网友提供的诸多种情形和解决方案,答主列举一种 mysql出现 Unknown column 'bname' in 'where clause'和Unknown column 'bid' in 'field list' 原文地址:https://www.cnblogs.com/hejh/

查询避免Unknown column ‘xxx’ in ‘where clause

问题: 单从字面理解,我们很容易得出列名称不存在的结论, 但是,很多时候并不是列名出错造成的,而是由于拼凑sql语句时对字符类型数据没有用引号引起来造成的. 例子: 例如:  String sql="select age from user where name="+xxx+"; 设置name的值为columName,则错误如下: Unknown column  'xxx′ in ‘where clause’ 解决步骤: sql中如果name是整型的倒不会出现什么错误,而如果

Column 'id' in where clause is ambiguous

1.错误描述 org.hibernate.exception.ConstraintViolationException: error executing work at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:72) at org.hibernate.exception.internal.StandardSQLExceptionConverter

错误代码: 1052 Column 'stu_id' in field list is ambiguous

1.错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:select stu_id, (SELECT stu_name FROM t_student_info t WHERE t_student_info.stu_id = t.stu_id) stu_name from t_student_info t, t_... 错误代码: 1052 Column 'stu_id' in field list is ambiguous 执行

java mybatis Column 'AAA' in where clause is ambiguous

今天在java mybatis项目中遇到一个问题,“java mybatis Column 'AAA' in where clause is ambiguous”, 这是由于在多表连接查询的时候,遇上有相同的字段,这个需要设置一下表名的前缀: 例: select * from lw_table lt where lt.column =  'xxxx' 在相关的地方加上lt前缀就可以了.这个错误也提醒开发写条件语句的时候最好是附上表明的前缀. java mybatis Column 'AAA' i

【MySQL 线上 BUG 分析】之 多表同字段异常:Column ‘xxx’ in field list is ambiguous

一.生产出错! 今天早上11点左右,我在工作休息之余,撸了一下猫.突然,工作群响了,老大在里面说:APP出错了! 妈啊,这太吓人了,因为只是说了出错,但是没说错误的信息.所以我赶紧到APP上看看. 这果然是出错了,而且还是简单而粗暴的500,太吓人了. 二.本地赶紧调试起来! 既然线上出错了,我们又不能直接进行调试,那当然得马上在本地搞起来了! 1.代码是否有错? 立马启动本地的项目,访问对应的接口,看看是不是代码哪里出错了. 好了,本地的代码和 SQL 都是没错的! 2.SQL 是否有错? 那