private PreparedStatement createQuery(String prefix, Connection con, Set<Key> keys, int count) {
        List<Object> parms = new ArrayList<>();
        List<Column> pk = getPk();
        StringBuilder sb = new StringBuilder();
        int rowIndex = 0;
        for (Key key : new HashSet<>(keys)) {
            keys.remove(key); // Remove as we go
            if (sb.length() > 0) {
                sb.append("\tOR ");
            }
            sb.append("(");
            for (int pkIdx = 0; pkIdx < pk.size(); pkIdx++) {
                if (pkIdx > 0) {
                    sb.append(" AND ");
                }
                Column col = pk.get(pkIdx);
                sb.append("[");
                sb.append(col.getColumnName());
                sb.append("]=?");

                // Grab the value of the parameter
                Object val = key.get(pkIdx);
                parms.add(val);
            }
            sb.append(")\n");
            if (++rowIndex >= count) {
                break;
            }
        }
        String sql = String.format("%s\nFROM [%s]\nWHERE %s", prefix, getName(), sb.toString());
        try {
            PreparedStatement stmt = con.prepareStatement(sql);
            for (int i = 0; i < parms.size(); i++) {
                Object javaVal = parms.get(i);
                Object sqlVal = javaToSql(javaVal);
                stmt.setObject(i + 1, sqlVal);
            }
            return stmt;
        } catch (Exception ex) {
            throw new RuntimeException("Error creating select query!", ex);
        }
    }