Hi there,

Are you planning on using the plain SQL API (passing strings with SQL
fragments to the various methods) or do you use the code generator? I'm
asking, because you're mixing the two styles, and that's quite unusual. You
have a reference to a COURSE table. If that reference really exists
(because you used the code generator), then I suggest you use those classes
everywhere, not strings.

Otherwise, do note that when you use the .innerJoin(String) method, then
the INNER JOIN keywords are already going to be generated by jOOQ, so no
need to repeat them in your SQL string.

Notice that your SQL is wrong. You cannot write (Person INNER JOIN Matric)
like this. There's a missing ON clause inside of the parentheses. So, what
I *think* you're trying to do is this:

Result<?> result = ctx.select()
                      .from(COURSE)
                      .innerJoin("(Person INNER JOIN Matric ON Person.lNum
= Matric.lPerson)")
                      .on("COURSE.LNUM=MATRIC.LCURSO")
                      .where("COURSE.lperiodoLet>=2017")
                      .fetch();

But better use the code generator, and avoid nesting joins. e.g.

Result<?> result = ctx.select()
                      .from(COURSE)
                      .innerJoin(MATRIC).on(COURSE.LNUM.eq(MATRIC.LCURSO))
                      .innerJoin(PERSON).on(PERSON.LNUM.eq(MATRIC.LPERSON))
                      .where(COURSE.LPERIODOLET.ge(2017))
                      .fetch();

I hope this helps,
Lukas
Am Mi., 20. Juni 2018 um 15:25 Uhr schrieb Junior Manzini <
[email protected]>:

>
> Hello everyone, I am totally newbie with jooq ... what I have done so far
> was just to search in a simple way but now reproduce this search and it is
> not working the way I am doing: Here's the research:
>
>    myQuery.Sql.add('FROM Course INNER JOIN (Person INNER JOIN Matric ON
> Person.lNum = Matric.lPerson) ON Course.lNum = Matric.lCurso ');
>     myQuery.Sql.add('WHERE Course.lPeriodoLet >= ' + getSPL);
>
> //This is the way I did, but there is an error
>
>   Result<?> result = ctx.select()
>                     .from(COURSE)
>                     .innerJoin("INNER JOIN (Person INNER JOIN Matric) ON
> (Person.lNum = Matric.lPerson)")
>                     .on("COURSE.LNUM=MATRIC.LCURSO")
>                     .where("COURSE.lperiodoLet>=2017")
>                     .fetch();
>
>
>
>
>
> --
> 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.

Reply via email to