Right now I have the following SQL:
select MAX(score) as score, title from
(
select 2 as score, title from tableName WHERE title LIKE '%railway employee%'
union
select 1 as score, title from tableName WHERE title LIKE '%railway%'
union
select 1 as score, title from tableName WHERE title LIKE '%employee%'
) as t1
group by title
order by score DESC
I would love to be able to do something like:
select MAX(score) as score, title from
(
select LEN(CurrentTerm) as score, title from tableName WHERE title LIKE IN ('%railway employee%', '%railway%', '%employee%')
) as t1
group by title
order by score DESC
The CurrentTerm
would be the matched term, not a column in table. Is there anything even remotely similar in SQL, specifically MySQL?