Вопрос по sql, sqlite – SQLite LIKE & ORDER BY Совпадение запроса

11

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

SELECT name FROM table WHERE name LIKE "%John%" ORDER BY name LIMIT 10;

Error: User Rate Limit Exceeded

If the field is equal (e.g. "John") If the field starts with "John" (e.g. "John Doe") If the field contains "John" (e.g. "Jane John Doe")

Error: User Rate Limit Exceeded

SELECT name FROM table WHERE name LIKE "%John%" ORDER BY CASE WHEN name = "John" 
THEN 1 ELSE 2 END, CASE WHEN name LIKE "John%" THEN 1 ELSE 2 END, name LIMIT 10;

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Ваш Ответ

2   ответа
6

ORDER BY name = "John" DESC, name LIKE "John%" DESC

16

SELECT name 
FROM table 
WHERE name LIKE "%John%" 
ORDER BY (CASE WHEN name = "John" THEN 1 WHEN name LIKE "John%" THEN 2 ELSE 3 END),name LIMIT 10 ;

Похожие вопросы