Michael Wa created TORQUE-322: --------------------------------- Summary: Support for SQL Set Operations (UNION, INTERSECT, ...) Key: TORQUE-322 URL: https://issues.apache.org/jira/browse/TORQUE-322 Project: Torque Issue Type: New Feature Affects Versions: 4.0 Reporter: Michael Wa
* It would be nice to support sql constructs like: SELECT * FROM sales2005 UNION SELECT * FROM sales2006; * If you want to realize the UNION operator you have to do something like that: [...] Criteria criteriaA = new Criteria(); criteriaA.where( ... ); criteriaA.addSelectColumn(COLUMNX); Query queryA = SqlBuilder.buildQuery(criteriaA); String sqlA = queryA.toString(); List<Object> replacementsA = queryA.getPreparedStatementReplacements(); Criteria criteriaB = new Criteria(); criteriaB.where( ... ); criteriaB.addSelectColumn(...); Query queryB = SqlBuilder.buildQuery(criteriaB); String sqlB = queryB.toString(); List<Object> replacementsB = queryB.getPreparedStatementReplacements(); List<Object> replacements = Lists.newArrayList(); replacements.addAll(replacementsA); replacements.addAll(replacementsB); String sql = COLUMNX + " IN (" + sqlA + " UNION " + sqlB + ")"; mainCriteria.whereVerbatimSql(sql, replacements.toArray()); [...] -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org