Mysql 以类似的方式逐案订购
这是有效的SQL语句吗Mysql 以类似的方式逐案订购,mysql,sql,sql-order-by,Mysql,Sql,Sql Order By,这是有效的SQL语句吗 select title from table order by case when title like "%string%" then 0 else 1 end asc 如果我使用title=“string”我会得到有效的结果。 我如何更改它以使其接受%string% select title from table order by case when title regexp "string" then 0 else 1 end asc; 我没有将其设置为^st
select title
from table
order by case when title like "%string%" then 0 else 1 end asc
如果我使用title=“string”
我会得到有效的结果。
我如何更改它以使其接受%string%
select title
from table
order by case when title regexp "string" then 0 else 1 end asc;
我没有将其设置为^string
,因为您正在搜索%string%
我没有将其设置为^string
,因为您正在搜索%string%
它是语法上有效的语句。如果
title=“string”
返回正确的结果-没有理由使用其他内容您想逐字匹配%string%
?仅供参考,like子句中的%
充当通配符Yes我想与wild匹配card@ChasingDeathtitle REGEXP“^string”
确实有效!请把它写在回答中。你试过你贴的东西吗?这有什么不对?它是语法上有效的语句。如果title=“string”
返回正确的结果-没有理由使用其他内容您想逐字匹配%string%
?仅供参考,like子句中的%
充当通配符Yes我想与wild匹配card@ChasingDeathtitle REGEXP“^string”
确实有效!请把它写在回答中。你试过你贴的东西吗?有什么问题吗?它比像“%string%”这样的标题更糟糕,而它做的工作完全相同。它比像“%string%”这样的标题更糟糕,而它做的工作完全相同