create as select

5 views
Skip to first unread message

oujevai...@gmail.com

unread,
Jul 6, 2016, 5:26:30 PM7/6/16
to jOOQ User Group
Hello,
i would like to know if there is a way to generate a request like this :

CREATE TABLE NEW_TABLE_NAME AS
   SELECT [ column1, column2...columnN ]
   FROM EXISTING_TABLE_NAME
   [ WHERE ]

If not what is the most effcient way to copy rows from a table to a new one ?
Thanks

Samir Faci

unread,
Jul 6, 2016, 10:54:51 PM7/6/16
to jooq...@googlegroups.com
I believe this should work.  


        dslContext.createTable("woot")
                .as(
                        dslContext.select(field("somefield"))
                        .from(table("some_other_table"))
                        .where(DSL.trueCondition())
                )
                .execute();


--
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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thank you
Samir Faci
Reply all
Reply to author
Forward
0 new messages