[Err] 1052 - Column 'XXXX' in field list is ambiguous

例如:

SELECT
id,
a.name,
price,
`describe`,
schoolid,
`subject`
FROM
tariffpackages a,
schooluser b
WHERE
a.schoolid=b.Schoolid

出现错误:

[SQL]SELECT
id,
a.name,
price,
`describe`,
schoolid,
`subject`
FROM
tariffpackages a,
schooluser b
WHERE
a.schoolid=b.Schoolid [Err] 1052 - Column 'schoolid' in field list is ambiguous

原因是:

tariffpackages表和schooluser表中都有schoolid字段。

解决方法:

SELECT
id,
a.name,
price,
`describe`,
a.schoolid,
`subject`
FROM
tariffpackages a,
schooluser b
WHERE
a.schoolid=b.Schoolid

MySql: Column 'XXXX' in field list is ambiguous 错误的更多相关文章

  1. Mysql Column 'xxxxx' in field list is ambiguous"

    使用了关联查询,两张表有相同的字段,所以说取值含糊不清: 使用别名.列名解决: 如 a.description

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

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

  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. column 'id' in field list is ambiguous

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

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

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

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

  7. SQL语句之Column 'Status' in where clause is ambiguous错误

    问题: AND created_by IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) limit 0, 10]; Column 'created_by' in where cla ...

  8. Column 'xxx' in field list is ambiguous

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

  9. Column 'u_id' in field list is ambiguous

随机推荐

  1. SSH框架中一些技巧、处理办法

    1.使用jstree插件时,操作成功直接刷新jstree 该页面(index.jsp)本身使用iframe框架jstree在leftFrame,操作页(add_input.jsp.add_succes ...

  2. 【2012noip提高组】借教室

    在大学期间,经常需要租借教室.大到院系举办活动,小到学习小组自习讨论,都需要 向学校申请借教室.教室的大小功能不同,借教室人的身份不同,借教室的手续也不一样. 面对海量租借教室的信息,我们自然希望编程 ...

  3. 关于ASP.Net的一些概念 转载

    ①理解 .NET Platform Standard 作者:田园里的蟋蟀 http://www.cnblogs.com/xishuai/archive/2016/05/24/understand-do ...

  4. 在vim保存时获得sudo权限

    在维护线上服务的时候,经常要编辑一些不属于操作用户的文件,比如只有r权限的文件,每次保存都会提示read only.这时可以使用如下命令代替原有的 :wq 命令 :w !sudo tee % 命令:w ...

  5. django之HttpRequest对象

    class HttpRequest[source] 属性 所有的属性都是只读的,除非另有说明 HttpRequest.scheme 字符串(http/https)表示http还是https请求 Htt ...

  6. c语言函数实现交换两个数的值

    代码: #include <stdio.h> void swap(int x,int y) { int temp; temp = x; x = y; y = temp; printf(&q ...

  7. CSS自学笔记(12):CSS3文字特效

    在CSS3中新增了多个文本属性,同样有了这些属性我们在进行问题特效处理时,就尽可能少的用到其他软件去制作特效文字了. 在以前使用CSS进行web开发的时候,必须使用计算机上安装好的字体,如果有些用户的 ...

  8. LINQ 联合查询

    List<Attachment> imgList = (from a in ZQSDWEBEntities.Attachment                               ...

  9. MySQL的三层架构之一----连接层

    1.mysql的服务端可以分为三层,分别是连接层,SQL层,存储层. 2.架构图 3.连接层定义了通信server端与client协议:

  10. 关于linux下内存使用的一些疑惑[转载]

    Linux内存机制-Cache与Buffer 在linux中经常发现空闲内存很少,似乎所有的内存都被系统占用了,表面感觉内存不够用了,其实不然.这是Linux内存管理的一个优秀特性,在这方面,区别于w ...