Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql search like order by best match

SELECT word
FROM words
WHERE word LIKE '%searchstring%'
ORDER BY
  CASE
    WHEN word LIKE 'searchstring%' THEN 1
    WHEN word LIKE '%searchstring' THEN 3
    ELSE 2
  END
Comment

PREVIOUS NEXT
Code Example
Sql :: différence entre deux dates sql oracle 
Sql :: delete table sql 
Sql :: how to delete table sqlite 
Sql :: postgresql group by month and year 
Sql :: select statement to print longest name 
Sql :: mysql reset auto increment to 1 
Sql :: table drop if exist sql server 
Sql :: postgresql get year 
Sql :: SQL query to convert DD/MM/YYYY to YYYY-MM-DD 
Sql :: how to drop a trigger in postgresql 
Sql :: difference between where and having clause 
Sql :: mysql select month and year 
Sql :: mysql sysdate - 1 day 
Sql :: how to select all attributes from a row if there is a certain string in it MySQL 
Sql :: how to create an empty table from an existing table 
Sql :: sql server reseed identity column 
Sql :: sql delete multiple conditions 
Sql :: mysql Like(searching in the string) 
Sql :: sQL query to get all table records count from a database 
Sql :: create table with select 
Sql :: oracle sysdate 
Sql :: pgAdmin - Please correct the Binary Path 
Sql :: oracle undo usage by session 
Sql :: t sql get foreign key 
Sql :: sql query to search for a string in all columns 
Sql :: oracle all source 
Sql :: flask sqlalchemy default value 
Sql :: how to use lower case in mysql 
Sql :: random name function in mysql for nvarchar 
Sql :: oracle replace 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =