Not assigned. I did exactly same as in the manual. how to assign it?
Thank you. ~Shyam On Wednesday, January 29, 2014 7:28:18 PM UTC+5:30, Lukas Eder wrote: > > Shyam, did you assign the "hlmTempTable" to a local variable (in Java)? Or > how else would the Java compiler know what you mean when you write > hlmTempTable? > > > 2014-01-29 Sha <[email protected] <javascript:>> > >> Thank you. >> >> But in below way >> ctx.select(hl.ITEM_ID,hl.HA_ID,(hl.PERIOD_ID).max()) >> .from(hl).groupBy(hl.ITEM_ID,hl.HA_ID).asTable(*"hlmTempTable"*, >> "ITEM_ID","HA_ID","PERIOD_ID"); >> >> When I say in memory table name as *hlmTempTable *gives error as below >> "*hlmTempTable cannot be resolved to a variable*" >> >> So getting compilation error. >> >> How to use it correctly ? >> >> thank you. >> ~Shyam >> >> >> On Wednesday, January 29, 2014 2:55:00 PM UTC+5:30, Lukas Eder wrote: >> >>> Your usage of asTable() is correct. In order to extract fields from an >>> "untyped" table (e.g. a derived table), use any of these methods: >>> >>> - http://www.jooq.org/javadoc/3.2.x/org/jooq/TableLike.html# >>> field(org.jooq.Field) >>> - http://www.jooq.org/javadoc/3.2.x/org/jooq/TableLike.html#field(int) >>> - http://www.jooq.org/javadoc/3.2.x/org/jooq/TableLike.html# >>> field(java.lang.String) >>> >>> Note that access by Field (the first variant) is using the argument >>> Field's qualified and / or unqualified name to extract a typed field from >>> the Table type. >>> >>> Hope this helps >>> Lukas >>> >>> >>> 2014-01-29 Sha <[email protected]> >>> >>>> Hi Lukas, >>>> I have very difficult time using Result list of query as temporary >>>> table. >>>> >>>> *Here are more details :* >>>> >>>> *Actual sql script* >>>> >>>> CREATE TABLE #hlm --- this is Temporary table hlm in SQL Server DB >>>> >>>> ( >>>> id INT IDENTITY(1, 1) NOT NULL, >>>> >>>> item_id INT, >>>> ha_id INT, >>>> period_id INT >>>> ) >>>> >>>> insert into #hlm (item_id, ha_id, period_id) >>>> SELECT item_id, >>>> ha_id, >>>> MAX(period_id) AS period_id >>>> from *hierarchy_leaf * >>>> group by ITEM_ID, ha_id >>>> >>>> *For the above i have written JOOQ equalent script as below in two >>>> ways.* >>>> >>>> HierarchyLeaf hl = HIERARCHY_LEAF.as("hl"); >>>> >>>> *Way 1 : * >>>> Table<Record3<Integer, Short, Integer>> hlmTempTable >>>> = ctx.select(hl.ITEM_ID,hl.HA_ID,(hl.PERIOD_ID).max()) >>>> .from(hl).groupBy(hl.ITEM_ID,hl.HA_ID).asTable(); >>>> >>>> *Way 2 : * >>>> ctx.select(hl.ITEM_ID,hl.HA_ID,(hl.PERIOD_ID).max()) >>>> .from(hl).groupBy(hl.ITEM_ID,hl.HA_ID).asTable("hlmTempTable", >>>> "ITEM_ID","HA_ID","PERIOD_ID"); >>>> >>>> >>>> *In both ways I tried but me not able to join the table hlmTempTable >>>> with other table.* >>>> >>>> *How to do it joining operation on derived table **hlmTempTable** ?* >>>> *Also any specific example how to use asTable method of table ?* >>>> >>>> Thank you. >>>> ~Shyam >>>> >>>> -- >>>> 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/groups/opt_out. >>>> >>> >>> -- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- 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/groups/opt_out.
