public static String getSQLSelectString(PoiCategoryFilter filter, int count, LatLong orderBy) {
        StringBuilder sb = new StringBuilder();
        sb.append(DbConstants.FIND_IN_BOX_CLAUSE_SELECT);
        sb.append(DbConstants.JOIN_CATEGORY_CLAUSE);
        sb.append(DbConstants.JOIN_DATA_CLAUSE);
        sb.append(DbConstants.FIND_IN_BOX_CLAUSE_WHERE);
        sb.append(getSQLWhereClauseString(filter));
        for (int i = 0; i < count; i++) {
            sb.append(i == 0 ? " AND (" : " OR ");
            sb.append(DbConstants.FIND_BY_DATA_CLAUSE);
            if (i == count - 1) {
                sb.append(")");
            }
        }
        if (orderBy != null) {
            sb.append(" ORDER BY ((").append(orderBy.latitude).append(" - poi_index.lat) * (").append(orderBy.latitude).append(" - poi_index.lat))")
                    .append(" + ((").append(orderBy.longitude).append(" - poi_index.lon) * (").append(orderBy.longitude).append(" - poi_index.lon)) ASC");
        }
        return (sb.append(" LIMIT ?;").toString());
    }
@Test
    public void selectTwoFromBalancedHierarchy() throws UnknownPoiCategoryException {
        PoiCategoryFilter filter = new WhitelistPoiCategoryFilter();
        filter.addCategory(this.balancedCm.getPoiCategoryByTitle("l1_1"));
        filter.addCategory(this.balancedCm.getPoiCategoryByTitle("l1_2"));

        String query = PoiCategoryRangeQueryGenerator.getSQLSelectString(filter, 0, null);

        System.out.println("Query: " + query);

        // TODO add assertions
    }