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

执行耗时   : 0 sec
传送时间   : 0 sec
总耗时      : 0 sec

2、错误原因

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_score_info t0
WHERE t.`stu_id` = t0.`stu_id` 

无法区别stu_id是属于哪张表,导致模糊不清

3、解决办法

SELECT
	t0.stu_id,
	(SELECT t.stu_name FROM t_student_info t WHERE t.stu_id = t1.stu_id) stu_name
FROM
	t_student_info t1,
	t_score_info t0
WHERE
	t1.`stu_id` = t0.`stu_id`

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

错误代码 1052 Column 'stu id' in field list is ambiguous

原文地址:https://www.cnblogs.com/odejsjhshw/p/10368376.html

时间: 2024-08-29 15:30:26

错误代码 1052 Column 'stu id' in field list is ambiguous的相关文章

转 column 'id' in field list is ambiguous的问题

column 'id' in field list is ambiguous 这个错误,是因为你查询语句里面有id字段的时候,没有说明是哪个表的id字段,应该加上表名(或者别名)来区分. 用表名进行区分的例子: select student.id, student.name, score.total from student, score where student.id = score.id 使用别名的例子: 用表名进行区分的例子: select s.id, s.name, c.total f

column 'id' in field list is ambiguous

column 'id' in field list is ambiguous 这个错误,是因为你查询语句里面有id字段的时候,没有说明是哪个表的id字段,应该加上表名(或者别名)来区分. 用表名进行区分的例子:select student.id, student.name, score.totalfrom student, scorewhere student.id = score.id 使用别名的例子:用表名进行区分的例子:select s.id, s.name, c.totalfrom st

错误:Column 'Id' in field list is ambiguous

SELECT `渠道名称` , SUM(`当日其他`) AS 当月其他 FROM `渠道信息` as A , `一线数据汇总` AS B WHERE A.`渠道名称` = B.`渠道名称` GROUP BY `渠道名称` 错误原因:表A和表B里都有'渠道名称',select时要指明是哪个表里的. SELECT A.`渠道名称` , SUM(`当日其他`) AS 当月其他 FROM `渠道信息` as A , `一线数据汇总` AS B WHERE A.`渠道名称` = B.`渠道名称` GROU

错误代码: 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 'username' in field list is ambiguous、邮件漏发等问题的分析及解决

问题1.Column 'username' in field list is ambiguous ### The error may involve com.fx.oa.module.per.leave.api.shared.domain.PositiveEntity.queryListForPage-Inline ### The error occurred while setting parameters ### Cause: com.mysql.jdbc.exceptions.jdbc4.

java.sql.SQLException: Unknown column 'user0_.user_name' in 'field list' 报错问题

报错信息: java.sql.SQLException: Unknown column 'user0_.user_name' in 'field list'Query is: select user0_.id as id1_0_, user0_.user_name as user_nam2_0_, user0_.password as password3_0_ from user user0_java thread: http-nio-8881-exec-1 Hibernate报错:说表里没有u

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

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

Unknown column 'User.ID' in order clauser

这个错误是因为你的User这个类里面定义的不是ID所以发生了这个错误,所有对照你User类中的定义的的字段名看有没有写错,改正过来就基本可以了.我的就是这样改正的. 有时候插入的那个字段在表里面可能它前面可能多了个空格而    去掉空格就好了    例如表里的字段名本来设置的是id,但是不小心前面加了个空格变成(空格id)这就造成了sql语 句的查询错误了 Unknown column 'User.ID' in order clauser