Insert extends QueryBuilder { @Override public QueryBuilder fromQuery(Iterable<String> fields, QueryBuilder query) { InsertFieldsFromQueryBlock block = (InsertFieldsFromQueryBlock) mBlocks.get(3); block.setFromQuery(fields, query); return this; } Insert(QueryBuilderOptions options); @Override QueryBuilder into(String table); @Override QueryBuilder set(String field, T value); @Override QueryBuilder fromQuery(Iterable<String> fields, QueryBuilder query);  }
@Test public void fromQuery() { QueryBuilder sel = Squel.select().from("students").where("a = ?", 2); QueryBuilder sql = Squel.insert() .into("table") .fromQuery(Arrays.asList("field1", "field2"), sel); String actual = sql.toString(); String expected = "INSERT INTO table (field1, field2) (SELECT * FROM students WHERE (a = 2))"; assertEquals(expected, actual); }