1、先看错误的sql语句:

select a.authName from roles as r,authority as a,role_ah as ra where ra.roleId=r.roleId and ra.ahId=a.ahId and roleId='R002'

2、再看正确的sql语句:

select a.authName from roles as r,authority as a,role_ah as ra where ra.roleId=r.roleId and ra.ahId=a.ahId and r.roleId='R002'

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

这句话的意思是:[Err]1052-where子句中的“roleId”列不明确

多个表中都有相同的属性列(我这里是角色表、权限表、角色权限联合表。角色权限联合表中包含着角色表和权限表中的主键)。在查询时,没有指定哪个表的属性列。

总结:当遇到多表查询、并且查询条件的属性列存在多个表时、需要显示定义具体表的属性列。

[Err] 1052 - Column ‘roleId‘ in where clause is ambiguous的更多相关文章

  1. Column 'id' in where clause is ambiguous

    1.错误描述 org.hibernate.exception.ConstraintViolationException: error executing work at org.hibernate.e ...

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

  3. java mybatis Column 'AAA' in where clause is ambiguous

    今天在java mybatis项目中遇到一个问题,“java mybatis Column 'AAA' in where clause is ambiguous”, 这是由于在多表连接查询的时候,遇上 ...

  4. 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.MySQLIntegrityConstraintViolatio ...

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

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

  6. Column ‘name’ in where clause is ambiguous;

    内容 一.异常信息 严重: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw except ...

  7. Java开发问题:Column 'AAA' in where clause is ambiguous解决办法

    当在java开发中遇到了Column 'AAA' in where clause is ambiguous问题时, 你需要去看看:多表查询的时候不同的表是否出现了相同名称相同的列, 如果存在,你需要在 ...

  8. Column 'orders' in order clause is ambiguous

    今天报了这个错误 原因是.当使用sql查询语句,使用了join查表.但是这个orders没指定是哪张表的字段 ,发生在自关联情况

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

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

随机推荐

  1. 十分钟教会你如何使用VitePress搭建及部署个人博客站点

    使用VitePress可以让我们快速搭建一个静态博客网站,这篇文章将带领大家搭建一个基于VitePress的静态博客网站并且部署到GitHub Pages(github提供的静态网页服务) 快速上手 ...

  2. 海豚调度直播来了 - 即将发版的1.3.0新特性及Roadmap路线

    在过去的3个多月,Apache DolphinScheduler(incuating)和DolphinScheduler社区发生了很多变化,今晚19:30在线直播将为大家介绍最新1.3.0的新特性及R ...

  3. 手把手教你springboot集成微信支付

    20220727 最近要做一个微信小程序,需要微信支付,所以研究了下怎么在 java 上集成微信支付功能,特此记录下. 本文完整代码:点击跳转 准备工作 小程序开通微信支付 首先需要在微信支付的官网点 ...

  4. java-前端之HTML

    --html网页简单使用 1.html网页的基本标签 <!doctype html><!-- 声明网页版本 --> <html><!-- 唯一的跟元素 --& ...

  5. 对于Java中的Loop或For-each,哪个更快

    Which is Faster For Loop or For-each in Java 对于Java中的Loop或Foreach,哪个更快 通过本文,您可以了解一些集合遍历技巧. Java遍历集合有 ...

  6. Knative部署应用以及应用的更新、应用的分流(二)

    1. 应用的更新 1.1 更新hello-example应用 1.更新应用的环境变量 可通过命令行的方式亦可以通过读取配置文件的方式,这里主要来看命令行的方式 [root@kn-server-mast ...

  7. KingbaseES 与Oracle 函数稳定性对于性能影响差异比较

    一.函数的属性 KingbaseES 函数在定义时有三种稳定性级别:volatile.stable 和 immutable.默认情况下,创建函数的稳定性为volatile.以下是这三种函数的区别: V ...

  8. MySQL8 Group By 新特性

    MySQL8 Group By 新特性 此生此夜不长好,明月明年何处看.   一.简介 MySQL8 新特性之 Group By 不再隐式排序.MySQL8对于group by 字段不再隐式排序,如需 ...

  9. 华南理工大学 Python第5章课后小测-1

    1.(单选)以下哪个函数的定义是错误的?(本题分数:2)A) def vfunc(a,b=2):B) def vfunc(a,b):C) def vfunc(a,*b):D) def vfunc(*a ...

  10. 【疑难杂症】关于Transformer到底是什么

    在学习transform的时候,很多视频上来就是一张图开始解释图里面残差网络,self-attention等等巴拉巴拉的意思,然后组装,看也看完了,但是还是不明白transformer和selfatt ...