Forcing second join

Ricardo Parada <[email protected]> Wed, 1 Oct 2025 20:36:56 -0400
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hello,=20

I=E2=80=99m wondering if it=E2=80=99s possible to force a second join to a t=
able. For example:

paintings.name like A% AND paintings.name like G%

In a SQL query, this will always return 0 records because a given painting c=
annot start with the letter A and G at the same time.  It either starts with=
 one or the other.=20

So if I=E2=80=99m looking for artists that have a painting with its name sta=
rting with the letter A and another one with the letter G then the SQL would=
 have to do a second join.=20

For example,

SELECT * FROM ARTIST t0
JOIN PAINTING t1 ON t1.ARTIST_ID =3D t0.ID
JOIN PAINTING t2 ON t2.ARTIST_ID =3D t0.ID
WHERE t1.NAME LIKE =E2=80=98A%=E2=80=99=20
AND  t2.NAME LIKE =E2=80=98G%=E2=80=99

Thanks in advance,=20
Ricardo Parada