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`

错误代码: 1052 Column 'stu_id' in field list is ambiguous的更多相关文章

  1. MySql: Column 'XXXX' in field list is ambiguous 错误

    [Err] 1052 - Column 'XXXX' in field list is ambiguous 例如: SELECT id, a.name, price, `describe`, scho ...

  2. column 'id' in field list is ambiguous

    column 'id' in field list is ambiguous  这个错误,是因为你查询语句里面有id字段的时候,没有说明是哪个表的id字段,应该加上表名(或者别名)来区分.

  3. (转载)在mysql中,column 'id' in field list is ambiguous

    (转载)http://blog.chinaunix.net/uid-20665047-id-3137284.html column 'id' in field list is ambiguous 这个 ...

  4. mysql错误:Column ‘id’ in field list is ambiguous的解决方法

    [Err] 1052 - Column 'modify_time' in where clause is ambiguous 出错的语句: SELECT AVG(T.se)%60FROM( SELEC ...

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

    一.生产出错! 今天早上11点左右,我在工作休息之余,撸了一下猫.突然,工作群响了,老大在里面说:APP出错了! 妈啊,这太吓人了,因为只是说了出错,但是没说错误的信息.所以我赶紧到APP上看看. 这 ...

  6. [Err] 1052 - Column ‘roleId‘ in where clause is ambiguous

    1.先看错误的sql语句: select a.authName from roles as r,authority as a,role_ah as ra where ra.roleId=r.roleI ...

  7. Column 'u_id' in field list is ambiguous

  8. Column 'xxx' in field list is ambiguous

    一 其实看一下ambiguous的翻译就好了 一开始我觉得是含糊什么的,后来找了下才知道应该是双关... 二 所以翻译过来就是 : 列'XX'在字段列表中双关 其实就是两张表有相同的字段,但是使用时, ...

  9. coding++:MySQL-ERROR:Column 'complaint_settlement_id' in field list is ambiguous

    (多表查询出现的问题)列'ID'在字段列表中重复,其实就是两张表有相同的字段,但是使用时表字段的名称前没有加表名,导致指代不明. 如 前面加上表名前缀就没问题了.

随机推荐

  1. c# 类属性和方法

    属性 public 类字段 就相当于c#里面暴露给外面的属性 类似nodejs的 module.exports 但是属性又不同于普通的字段,属性只是外部包装字段 没有自己的任何含量 类似退换后的方法. ...

  2. php操作mongodb的常用函数

    连接mongodb: $mongoObj = new Mongo("127.0.0.1" , array( 'connect'=>true, 'persist'=>tr ...

  3. centos6.8 安装gitlab记录

    sudo yum install -y curl policycoreutils-python openssh-server cronie sudo lokkit -s http -s ssh sud ...

  4. MySQL分区表基础

    首先要确定MySQL是否支持分区: Mysql> SHOW VARIABLES LIKE '%partition%'; +-----------------------+-------+| Va ...

  5. Cookie、session和localStorage、以及sessionStorage之间的区别

    一.Cookie.session和localStorage的区别 cookie的内容主要包括:名字.值.过期时间.路径和域.路径与域一起构成cookie的作用范围.若不设置时间,则表示这个cookie ...

  6. 济南清北学堂游记 Day 6.

    还剩一天半我就该回去了. 说实话今天挺可惜的,有很多本来可以得到的分数评测时没有拿到.上午的第一题和第二题我都想出了正解,T3敲了一个暴力,虽然暴力写坏了.预计是可以拿210的但是实际上只有很少的分数 ...

  7. macbook air扩展显示器全屏滑动怎样不一起滑动?

    macbook air 外接了一个显示器(扩展),当我有多个桌面时,用手指滑动触控板切换桌面时,扩展屏幕也跟着切换桌面有什么办法能让我在切换主屏幕桌面的时候,扩展屏幕保持不动呢?上周还好好的,昨晚关机 ...

  8. ★Linux桌面系统技巧(作为客户端)

    [安装chrome浏览器]* 下载(已下载完成):32位:wget https://dl.google.com/linux/direct/google-chrome-stable_current_i3 ...

  9. 深入java虚拟机学习 -- 类的加载机制

    当看到"类的加载机制",肯定很多人都在想我平时也不接触啊,工作中无非就是写代码,不会了可以百度,至于类,jvm是怎么加载的我一点也不需要关心.在我刚开始工作的时候也觉得这些底层的内 ...

  10. struts 中的创建Action的三种方法

    1.对于直接创建类,不实现接口和继承任何的类 例如创建一个helloAction package cn.lonecloud.control; import com.opensymphony.xwork ...