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(‘role‘)
->field(‘r.rid,r.rolename,u.username‘)
->alias(‘r‘)
->join(‘user u‘,‘u.rid=r.rid‘,‘‘)
->where($search)
->group(‘r.rid‘)
->count();
//处理查询后的数据
$data=$this->array_group_concat($result, ‘username‘, ‘rid‘);
$arr[‘data‘]=$data;
$arr[‘count‘]=$count;
if($result){
return $arr;
}else{
return [];
}

}

两表联查的时候出现以上错误,当联表查,涉及到以什么为准进行排序的时候,如果两个表里的

排序字段相同,需要指定以哪个表里的字段进行排序。

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

原文地址:https://www.cnblogs.com/ymdphp/p/11038192.html

时间: 2024-08-29 13:37:04

Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous的相关文章

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 Col

错误代码: 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 执行

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

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] ##

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

错误代码 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 执行

loader constraint violation错误

HTTP Status 500 - java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" the class loader

java.lang.LinkageError: loader constraint violation: when resolving interface method

异常:java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/Expression...... jbpm4 在tomcat6 下面ssh2 这个错误!原因是项目中WEB-INF/lib中的三个jar包(juel.jar, juel-engi

javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation:

javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" th