Hello!
Let's say I've got an HQL query that's looking something like this:
Code:
from MyTable t where
t.field1 = 'something' and
t.bar = 'blah' or
t.bar2 = 'blah2' or
t.field3 = 'that'
Well, unfortunately that doesn't work the way I want, because it of course returns 't.field1' results that _do_not_ equal "something", so long as 't.bar', 't.bar2', etc equal one of those specified values.
I want to ensure that the results returned from the query only produce records where 't.field1' == 'something' BUT where one or more of those OR's are also satisfied.
Using sql, I'd use an except clause, something like:
Code:
select * from MyTable where
bar = 'blah' or
bar2 = 'blah2' or
field3 = 'that'
except (
select * from MyTable where
field1 != 'something' )
How would I achieve equivalent results using HQL?
Many thanks!