sql = String.format("SELECT %s as a, case when %s_upper LIKE ?||'%%' then 1 " +
"WHEN %s_upper LIKE '%%:'||?||'%%' then 2 " +
"WHEN %s_upper LIKE '%% '||?||'%%' then 3 else 9 end " +
"FROM %s " +
"WHERE profile=? AND %s_upper LIKE '%%'||?||'%%' " +
"ORDER BY 2, 1;", field, field, field, field, table, field);
sql = String.format("SELECT %s as a, case when %s_upper LIKE ?||'%%' then 1 " +
"WHEN %s_upper LIKE '%%:'||?||'%%' then 2 " +
"WHEN %s_upper LIKE '%% '||?||'%%' then 3 else 9 end " +
"FROM %s " +
"WHERE profile=? AND %s_upper LIKE '%%'||?||'%%' " +
"ORDER BY 2, 1;", field, field, field, field, table, field);