Order By: Returning unLIKE before LIKE?
sql, sqlite
Solution
"x" like 'm%' is FALSE; "motorcade" like 'm%' is TRUE; "FALSE" < "TRUE".
Problem
This should be an easy one, but I am having a moment. Why does ORDER BY with LIKE sort the matching results as a higher value than the non-matching? To get the results I expect I have to mix ASC and DESC on what is otherwise the same data: ``` create table foo (name text); select name from foo order by name like 'm%' desc, name; ```