SQLQuery query = new SQLQuery(SQLTemplates.DEFAULT);
query.with(survey1, new SQLSubQuery().from(survey1).list(survey1.all()));
query.union(
new SQLSubQuery().from(survey2).list(survey2.all()),
new SQLSubQuery().from(survey3).list(survey3.all()));
assertEquals("with survey1 as (select survey1.NAME, survey1.NAME2, survey1.ID\n" +
"from SURVEY survey1)\n" +
"(select survey2.NAME, survey2.NAME2, survey2.ID\n" +
"from SURVEY survey2)\n" +