Hello,

You can use either DSL.field(Select), or FieldLike.asField() to get a Field
type from a correlated subquery:

-
http://www.jooq.org/javadoc/latest/org/jooq/impl/DSL.html#field-org.jooq.Select-
- http://www.jooq.org/javadoc/latest/org/jooq/FieldLike.html#asField--

Also, if you're using PostgreSQL, table-valued functions are supported by
the code generator and produce Table references that you can use easily in
your SQL statements. There has been a post about this a while ago on the
jOOQ blog:
http://blog.jooq.org/2014/07/07/postgresqls-table-valued-functions/

In case your myProcedure doesn't produce a scalar value, but a TABLE (or
SETOF TABLE) type, you might be more lucky if you're LATERAL joining that
function to your table "a". Let me know if you have any specific questions
regarding the above.

Cheers
Lukas

2014-12-02 9:55 GMT+01:00 <[email protected]>:

> Hi Lukas,
> I want to add couple of nested select statements to
> my SelectQuery<Record>.
>
>    - Sample JOOQ query,
>
>     SelectQuery<Record> selectQ = dsl.selectQuery();
>     selectQ.addSelect(a.id,a.name,*<????>*,a.date);
>     selectQ.addFrom(a);
>     selectQ.addConditions(a.id.equal(aId).and(a.date.equal(new
> java.sql.Timestamp(aDte.getTime()))));
>     return selectQ.fetch()
>
>
>    - Actual Requirement in plain SQL,
>
> Select a.id, a.name, *(select val from myProcedure(a.value))*, a.Date
> from a Where (a.id=aId) and (a.date=aDte)
>
>
> Could you please shed me some light on this?
>
> Thanks,
> Buddhika E.
>
>
> --
> 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