Hi,

   What I'm trying to accomplish is to build a simple INSERT INTO (....) 
SELECT ... FROM type query.

The table I'm inserting into has a TableImpl<Record> implementation. The 
select query does not, its a SQL string I've wrapped in DSL.table().

My jooq TableImpl<Record> look like this:

public class TenantTable extends TableImpl<Record> {

public static final TenantTable TENANT_TABLE = new TenantTable();
public final TableField<Record, String> API_TOKEN = 
createField("api_token", SQLDataType.VARCHAR.length(36), this);
public final TableField<Record, EventType> EVENT_TYPE = 
createField("event_type", SQLDataType.VARCHAR.length(16), this, null, 
EventTypeConverter.INSTANCE);
public final TableField<Record, Integer> YEAR = createField("year", 
SQLDataType.INTEGER, this);
public final TableField<Record, Integer> MONTH = createField("month", 
SQLDataType.INTEGER, this);
public TenantTable() {
super("tenant_table");
}
}

And my table-like subquery look like this

Table<Record> foo = table("SELECT A, B, C, D FROM Foo");  //simplification 
but u get the idea

I'm trying to do something like this....

dslContext.insertInto(TENANT_TABLE, TENANT_TABLE.EVENT_TYPE, TENANT_TABLE.
API_TOKEN, TENANT_TABLE.MONTH, TENANT_TABLE.YEAR).select(selectFrom(foo));


Obviously its nowhere near compiling...

ultimately I'm trying to generate the following SQL:

INSERT INTO tenant(api_token, event_type, year, month) select A,B,C,D FROM 
Foo;


How do I accomplish the above?

Thanks!





-- 
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