I have the select query with or logical operator like following:
SELECT * FROM grabli_new.product where article like '%AV2%' or article like '%AV22%';
I need to ordering result set by "length of like pattern"(rows that contains the longest pattern in my case '%AV22%' must be in the beginning of result set). The query must return all result that contains '%AV22%' pattern in the beginning and only then all result that contains '%AV2%' pattern. Is it possible?