mysql查询user_id重复数据

来源:互联网 发布:网络女歌手唱的谁不是 编辑:程序博客网 时间:2024/05/16 15:22

在项目中遇到一个问题,在调用findByUserIdAndStartTime()这个jpa里面的方法,报错: javax.persistence.NonUniqueResultException: result returns more than one elements.

最后在数据库里面用了下面一条sql语句查询user_id>1的数据,看是否有数据错误:

SELECT user_id,start_time FROM ovuola_test.physiological_estimate_data where user_id in (select user_id from ovuola_test.physiological_estimate_data group by user_id having count(1) >= 2);


原创粉丝点击