FromItem fromItem1 = q.from(table, "t1").getFromClause().getItem(0);
FromItem fromItem2 = q.from(table, "t2").getFromClause().getItem(1);
q.select(table.getColumnByName("foo"), fromItem1);
q.select(table.getColumnByName("foo"), fromItem2);
q.where(q.getSelectClause().getItem(0), OperatorType.EQUALS_TO, "2");
assertEquals("SELECT t1.foo, t2.foo FROM sch.tab t1, sch.tab t2 WHERE t1.foo = '2'", q.toSql());
DataSet ds = dc.executeQuery(q);
SelectItem[] selectItems = ds.getSelectItems();
assertEquals(2, selectItems.length);
assertEquals("t1.foo", selectItems[0].toSql());