【bug - postgresql】PSQLException: ERROR: column reference “id“ is ambiguous


项目场景:

        Spring cloud + Mybatis-plus + postgresql



问题描述:

        关联查询报错

PSQLException: ERROR: column reference "id" is ambiguous


原因分析:

        关联查询时两个表均有id



解决方案:

        设置表别名 a,b 

若返回对象只需要取a的id select a.id  即可,如图.XXMapper.xml

同理

   PSQLException: ERROR: column reference "XX" is ambiguous 

posted @ 2021-12-14 15:53  随风落木  阅读(8)  评论(0编辑  收藏  举报  来源