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. R语言的神奇之基于向量

    对于大多数需要来说,当我们需要计算两个向量相加时,我们需要分别对这两个向量的元素进行遍历,所以写起来非常的麻烦.下面看看R语言是如何实现的. 首先,将1:5赋予一个名为x的向量 > X<- ...

  2. 使用TensorFlow Object Detection API+Google ML Engine训练自己的手掌识别器

    上次使用Google ML Engine跑了一下TensorFlow Object Detection API中的Quick Start(http://www.cnblogs.com/take-fet ...

  3. Eclipse的调试功能的10个小窍门[转]

    原文链接:http://www.importnew.com/6164.html 你可能已经看过一些类似“关于调试的N件事”的文章了.但我想我每天大概在调试上会花掉1个小时,这是非常多的时间了.所以非常 ...

  4. BZOJ 2084: [Poi2010]Antisymmetry [Manacher]

    2084: [Poi2010]Antisymmetry Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 609  Solved: 387[Submit] ...

  5. AGC017 F - Zigzag

    传送门 Time limit : 4sec / Memory limit : 256MB Score : 1600 points Problem Statement There are N(N+1)⁄ ...

  6. XML+JSON面试题都在这里

    XML+JSON常见面试题 什么是JSON和XML 什么是JSON和XML JSON:JavaScript Object Notation [JavaScript 对象表示法]. XML:extens ...

  7. 【模板小程序】求第n个fibonacci数

    //fibonacci,find the nth num. 1 1 2 3 5 8... #include <iostream> using namespace std; int fib( ...

  8. request、response的setCharacterEncoding与response的setContentType

    一.request中的setCharacterEncoding方法:作用是用指定的编码集去覆盖request对象中的默认的"ISO-8859-1"编码集,如"UTF-8& ...

  9. JAVAEE——BOS物流项目05:OCUpload、POI、pinyin4J、重构分页代码、分区添加、combobox

    1 学习计划 1.实现区域导入功能 n OCUpload一键上传插件使用 n 将文件上传到Action n POI简介 n 使用POI解析Excel文件 n 完成数据库操作 n 使用pinyin4J生 ...

  10. shared_lock and unique_lock

    简单的说: shared_lock是read lock.被锁后仍允许其他线程执行同样被shared_lock的代码.这是一般做读操作时的需要. unique_lock是write lock.被锁后不允 ...