jpa 2.0 criteria api expression for sql minus

我只是一个虾纸丫 提交于 2020-01-02 13:45:12

问题


How do you create a jpa Criteria expression that is equivalent to the sql minus statement

example

  SELECT mod_code
  FROM SRS.Table1
MINUS
  SELECT mod_code
  FROM SRS.Table2;

回答1:


Minus does not exist but you can do something like that:

select t1.mod_code from Table1 t1 where not exists 
(select t2 from table2 t2 where t2.mode_code = t1.mode_code)


来源:https://stackoverflow.com/questions/6923801/jpa-2-0-criteria-api-expression-for-sql-minus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!