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

问题:

AND created_by IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

limit 0, 10]; Column 'created_by' in where clause is ambiguous; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'created_by' in where clause is ambiguous

原因:

说明SQL语句中有重复的created_by功能调用,并且在Mapper文件中,多表关联查询中有相同的字段,在查询条件里,没有指定别名。

 

 

解决:

只需要给相同的字段加上别名即可

 

posted @ 2021-01-27 20:13  骚哥  阅读(3686)  评论(0编辑  收藏  举报