Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个这样的列族:
我做了一个 SELECT * FROM image_index WHERE type = "image_by_size" ORDER BY value DESC;
是否可以像 int 一样比较文本?
@Jacky Lormoz
将数字(不是特别是 int,它也适用于 long 或 double)作为字符串进行比较时要非常小心。
例子
1L < 2L < 10L
但
“1” < “10” < “2”
如果要将数字作为字符串进行比较,请在左侧添加 0。
“01” < “02” < “10”
现在,根据号码的长度,您可能需要在左侧添加许多 0:
“000001”<“000002”<“000010”