setSubSelect(null); // clear any previously found sub-SELECTs
if (getWhere() != null)
{
ElementWalker walker = new ElementWalker(getElementVisitor(), null);
walker.visit(getWhere());
if (getSubSelect() != null)
{
if (log.isTraceEnabled()) log.trace("Found sub-SELECT: {}", getSubSelect());
return SelectBuilder.fromSelect(getSubSelect());