Hi James,
Thank you very much for your enquiry. That would be surprising indeed, but
I cannot seem to reproduce it. For instance, the following:
System.out.println(
DSL.or(
field("A").eq(1).and(field("B").eq(2)),
field("C").eq(3).and(field("D").eq(4))
)
);
Yields:
(
(
A = 1
and B = 2
)
or (
C = 3
and D = 4
)
)
Are you sure your simplified query (which doesn't compile, btw, as you're
missing arguments to the eq() methods) does reflect the actual query where
you experienced this?
Note that there is also a where(Condition...) overload, which connects
conditions with AND at the top level. In case you got the parentheses wrong.
Lukas
2016-04-12 16:19 GMT+02:00 <[email protected]>:
> I'm trying to create a complex WHERE condition using the jOOQ DSL and it's
> not working as expected. I'm using version 3.7.2.
> Here is the SQL I'm trying to output:
>
> WHERE ((field1 = ? AND field2 = ?) OR (field3 = ? AND field4 = ?))
>
> I'm trying to use the jOOQ DSL like the following:
>
> .where(DSL.or(FIELD1.eq().and(FIELD2.eq()), FIELD3.eq().and(FIELD4.eq())))
>
> This outputs an `AND` between the two conditions. Is this a correct use of
> `DSL.or`? Is there another means of accomplishing what I would like to do?
>
> Thanks,
> James Lorenzen
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.