.append((scope.focusIsString() || (scope.getBrowseType() == AUTHORS_BROWSE)) ? "" : ", item_id");
.append(((scope.focusIsString() && (scope.getBrowseType() != ITEMS_BY_DATE_BROWSE)) || (scope.getBrowseType() == AUTHORS_BROWSE)) ? "" : ", item_id{2}");
    private static String createSqlInternal(BrowseScope scope,                                            String itemValue,                                            boolean isCount)        throws SQLException    {        String tablename = BrowseTables.getTable(scope);        String column = BrowseTables.getValueColumn(scope);                int browseType = scope.getBrowseType();                StringBuffer sqlb = new StringBuffer();        sqlb.append("select ");        sqlb.append(isCount ? "count(" : "");       	sqlb.append(getTargetColumns(scope));       	sqlb.append(isCount ? ")" : "");       	       	/**        	 * This next bit adds another column to the query, so        	 * authors don't show up lower-case       	 **/        if (browseType == AUTHORS_BROWSE && !isCount)	{		sqlb.append(",author");	}	        sqlb.append(" from ");        sqlb.append(tablename);        // If the browse uses items (or item ids) instead of String values        // make a subquery.        // We use a separate query to make sure the subquery works correctly        // when item values are the same. (this is transactionally        // safe because we set the isolation level).        // If we're NOT searching from the start, add some clauses        boolean addedWhereClause = false;        if (scope.hasFocus())        {            String subquery = null;            if (scope.focusIsItem())                subquery = new StringBuffer()                    .append(" or ( ")                    .append(column)                    // Item id must be before or after the desired item                    .append(" = ? and item_id {0}  ")                    .append(scope.getFocusItemId())                    .append(")")                    .toString();            if (log.isDebugEnabled())                log.debug("Subquery is \"" + subquery + "\"");            sqlb                .append(" where ")                .append("(")                .append(column)                // Operator is a parameter                .append(" {1} ")                .append("?")                .append(scope.focusIsItem() ? subquery : "")                .append(")");            addedWhereClause = true;        }        String connector = addedWhereClause ? " and " : " where ";        sqlb.append(getScopeClause (scope, connector));        // For counting, skip the "order by" and "limit" clauses        if (isCount)            return sqlb.toString();        // Add an order by clause -- a parameter	sqlb.append(" order by ").append(column).append("{2}")       	// If an item, make sure it's ordered by item_id as well       	.append((scope.focusIsString() ||  	    (scope.getBrowseType() == AUTHORS_BROWSE))       	    ? "" : ", item_id");        // A limit on the total returned (Postgres extension)        if (! scope.hasNoLimit())            sqlb.append(" LIMIT {3} ");        return sqlb.toString();    }