Cassandra SELECT 两个日期之间
Cassandra SELECT BETWEEN two dates
如何将以下 SQL 查询转换为 CQL 查询?
SELECT * FROM csv_report WHERE sensor_id=170268 AND create_day BETWEEN 20150401 AND 20150403;
我也在尝试不同的 BETWEEN 查询:
SELECT * FROM csv_report WHERE sensor_id=170268 AND create_day >= 20150401 AND create_day <= 20150403;
但是这个查询引发了一个错误:
code=2200 [Invalid query] message="Only EQ and IN relation are supported on the partition key (unless you use the token() function)"
试试这个
SELECT *
FROM csv_report
WHERE sensor_id=170268
AND create_day IN (20150401, 20150402, 20150403);
如何将以下 SQL 查询转换为 CQL 查询?
SELECT * FROM csv_report WHERE sensor_id=170268 AND create_day BETWEEN 20150401 AND 20150403;
我也在尝试不同的 BETWEEN 查询:
SELECT * FROM csv_report WHERE sensor_id=170268 AND create_day >= 20150401 AND create_day <= 20150403;
但是这个查询引发了一个错误:
code=2200 [Invalid query] message="Only EQ and IN relation are supported on the partition key (unless you use the token() function)"
试试这个
SELECT *
FROM csv_report
WHERE sensor_id=170268
AND create_day IN (20150401, 20150402, 20150403);