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;
"x" like 'm%' is FALSE; "motorcade" like 'm%' is TRUE; "FALSE" < "TRUE".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With