在 SQL Server 中,我可以使用这个 SQL 语句:
SELECT *
FROM Customers
WHERE Country LIKE '%land%';
此查询将返回包含字符串 land
的值。
是否可以按字符串land
的位置对返回值进行排序?
例子:
输入值:“新西兰、美国、Landcountry、Alandia”
输出值:“Landcountry, Alandia, New Zealand”
最佳答案
您可以使用 CHARINDEX
SELECT * FROM Customers
WHERE Country LIKE '%land%'
order by charindex('land', Country)
关于sql - 使用 LIKE 运算符的订单结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28169225/