次の SQL クエリ (MySQL) に問題があります。
SELECT CAST(LEFT(SUBSTR(STORE.VALUE, LOCATE('timestamp":', STORE.VALUE)+11),13) AS UNSIGNED) as starttime
FROM STORE
HAVING starttime <= MIN(starttime)+600000;
このクエリは 1 つの値を返します。1344543364317
これは、列 starttime の最小値です。
計算が手動で行われる次のクエリは、より多くの値を返します。
SELECT CAST(LEFT(SUBSTR(STORE.VALUE, LOCATE('timestamp":', STORE.VALUE)+11),13) AS UNSIGNED) as starttime
FROM STORE
HAVING starttime <= 1344543964317;
このクエリがより多くの値を返すのはなぜですか?
編集
データについての説明: 残念ながら、ほとんどのデータは役に立たないものです。基本的に、テーブルにはキー、値の 2 つの列のみが含まれます。ここではキーは重要ではありません。値には次のようなものが含まれます。{"changeset":"Z:1>6b|5+6b$Welcome to Etherpad Lite!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nEtherpad Lite on Github: http://j.mp/ep-lite\n","meta":{"author":"","timestamp":1344543364317,"atext":{"text":"Welcome to Etherpad Lite!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nEtherpad Lite on Github: http://j.mp/ep-lite\n\n","attribs":"|6+6c"}}}
したがって、基本的には、タイムスタンプ値を抽出して、starttime という仮想列として表示するだけです。starttime 列の最初の 10 個の値は次のとおりです。
1344543364317
1344543365939
1344543366439
1344543366454
1344543368794
1344553433259
1344553434054
1344553499779
1344553500871
1344553502104