Hi Lukas,
  As you advised me trying to emulate the temporary table scenario using 
asTable() method.

But I one more challenge here.

Below is the sample scenario to explain the problem.

*The piece which i am trying to covert to JOOQ equalent is below*


CREATE TABLE #hlm         -- *this is a temp table in SQLServer 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 h_leaf             
        group by ITEM_ID, ha_id


*JOOQ equalent i have written*

HLeaf  hl = H_LEAF.as("hl"); 

Table<Record3<Integer, Short, Integer>> hlmTempTable = 
ctx.select(hl.ITEM_ID,hl.HA_ID,((hl.PERIOD_ID).max()).as("PERIOD_ID"))
   .from(hl).groupBy(hl.ITEM_ID,hl.HA_ID).asTable().as("hlmTempTable");

This working as expected but the problem is how to achieve the effecting of 
auto increment.
i.e the missing column "* id             INT IDENTITY(1, 1) NOT NULL, "*

How to about it with JOOQ ?

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.

Reply via email to