1.底下这种in查询,Hibernate中分页查询,分页出现某些数据重复出现

and ap.dep_id in (select id from t_department connect  by prior id = parent_id start with id in ('8b8cf024607293f5016072d983d10007') ) 

//select id from t_department connect  by prior id = parent_id start with id in ('8b8cf024607293f5016072d983d10007')  查询当前部门,及其子部门所有的id

2.上面错误改成exists查询就好了

   and exists( select id from t_department where ap.dep_id=id connect by  priorid = parent_id start with id in ('8b8cf024607293f5016072d983d10007' ) )

还有对于oracle查询来说,in查询中的数据最多为1000,超过1000也会报错,所以在知道数据不会超过1000的情况下,用in查询,如果已经预知到数据要超过1000,最好改为exists查询

 微信公众号

 

 

相关文章:

  • 2021-05-30
  • 2022-12-23
  • 2021-08-08
  • 2021-09-01
  • 2021-09-26
  • 2021-09-05
  • 2022-12-23
  • 2021-12-11
猜你喜欢
  • 2022-02-22
  • 2022-03-03
  • 2022-01-04
  • 2021-08-15
  • 2021-04-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案