I want to supply a list of names like: 'car','red'.
I have 2 tables:
A
id
b_id
B
id
name
I want to be able to select record and order them by a list:
SELECT *
FROM a
JOIN b ON b.id = a.b_id
ORDER BY b.name IN ('car','red')
LIMIT 5
If the names are not in the list, then they appear after the items in the list, they do not get excluded.
I tried the above query, but it just gives me random items. The list is arbitrary and I must reference them by name. How can I do this when I only have that list.