[英]Mysql: maximum number of columns in ORDER BY clause?
SELECT DISTINCT city, street, street_type, house
FROM table
WHERE street LIKE '%Ololo%'
ORDER BY city, street, street_type, CHAR_LENGTH(house), house
Found that CHAR_LENGTH(house)
doesn't sort by it if placed on 4th position in ORDER BY. 发现如果将
CHAR_LENGTH(house)
放在ORDER BY中的第4位,则不会CHAR_LENGTH(house)
排序。 It starts to sory by CHAR_LENGTH(house)
only if it's placed on 1..3 position. 仅当它放置在1..3位置时,它才会由
CHAR_LENGTH(house)
开始发出声音。 city, street, street_type
all contain the same data in this example. 在此示例中
city, street, street_type
都包含相同的数据。 Tried to CONCAT first columns in ORDER BY: doesn't help. 尝试在ORDER BY中的CONCAT第一列中使用:没有帮助。
house
contains chars that's why I used CHAR_LENGTH(house), house
house
包含字符,这就是为什么我使用CHAR_LENGTH(house), house
If house
is char
, try CHAR_LENGTH(TRIM(house))
to remove trailing spaces 如果
house
是char
,请尝试CHAR_LENGTH(TRIM(house))
删除尾随空格
Otherwise, it means that city, street, street_type
are actually different: these are breaking the sort. 否则,这意味着
city, street, street_type
实际上是不同的:它们打破了排序。 When it goes back to short again, one of these changes 当它再次变短时,这些变化之一
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.