/** * Form a compound select with the given query using the INTERSECT operator * * @param query a Query object to append with the INTERSECT operator * @return this Query object, to allow chaining method calls * @see <a href="http://www.sqlite.org/lang_select.html#compound">http://www.sqlite.org/lang_select.html#compound</a> */ public Query intersect(Query query) { if (immutable) { return fork().intersect(query); } addCompoundSelect(CompoundSelect.intersect(query)); return this; }
public void testIntersect() { Query query = Query.select().from(Employee.TABLE).where(Employee.MANAGER_ID.eq(1)) .intersect(Query.select().from(Employee.TABLE).where(Employee.ID.eq(2))) .orderBy(Employee.ID.asc()); SquidCursor<Employee> cursor = database.query(Employee.class, query); try { assertEquals(1, cursor.getCount()); cursor.moveToFirst(); assertEquals(cookieMonster, new Employee(cursor)); } finally { cursor.close(); } }
/** * Form a compound select with the given query using the INTERSECT operator * * @param query a Query object to append with the INTERSECT operator * @return this Query object, to allow chaining method calls * @see <a href="http://www.sqlite.org/lang_select.html#compound">http://www.sqlite.org/lang_select.html#compound</a> */ public Query intersect(Query query) { if (immutable) { return fork().intersect(query); } addCompoundSelect(CompoundSelect.intersect(query)); return this; }