Farouk Alhassan
Farouk Alhassan

Reputation: 3808

jpa 2.0 criteria api expression for sql minus

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;

Upvotes: 3

Views: 5051

Answers (1)

GaetanZ
GaetanZ

Reputation: 3069

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)

Upvotes: 4

Related Questions