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 のようなテキストを比較することは可能ですか?
@ジャッキー・ロルモズ
数値 (具体的には int ではなく、long または double にも適用されます) を文字列として比較する場合は、十分に注意してください。
例
1L < 2L < 10L
しかし
"1" < "10" < "2"
数値を文字列として比較する場合は、左パディングに 0 を追加します。
"01" < "02" < "10"
ここで、数字の長さによっては、左側に多くの 0 を追加する必要がある場合があります。
"000001" < "000002" < "000010"