cassandra:同一列上的多个条件
caassandra : multiple condition on same column
创建 table :
CREATE TABLE notifications (
id uuid PRIMARY KEY,
user_id bigint,
received_datetime timestamp,
);
cqlsh :
select count(*)
from notifications
where received_datetime >='2016-10-11 00:00:00'
and received_datetime >='2016-10-18 00:00:00'
ALLOW FILTERING;
错误得到:-
InvalidRequest: Error from server: code=2200 [Invalid query] message="More than one restriction was found for the start bound on received_datetime"
我想您真正想要的是以下查询:
select count(*) from notifications
where received_datetime >='2016-10-11 00:00:00'
and received_datetime <='2016-10-18 00:00:00'
ALLOW FILTERING;
否则,您可以通过选择限制性更强的条件将两个下限条件合并为一个条件:
select count(*) from notifications
where received_datetime >= '2016-10-18 00:00:00'
ALLOW FILTERING;
创建 table :
CREATE TABLE notifications (
id uuid PRIMARY KEY,
user_id bigint,
received_datetime timestamp,
);
cqlsh :
select count(*)
from notifications
where received_datetime >='2016-10-11 00:00:00'
and received_datetime >='2016-10-18 00:00:00'
ALLOW FILTERING;
错误得到:-
InvalidRequest: Error from server: code=2200 [Invalid query] message="More than one restriction was found for the start bound on received_datetime"
我想您真正想要的是以下查询:
select count(*) from notifications
where received_datetime >='2016-10-11 00:00:00'
and received_datetime <='2016-10-18 00:00:00'
ALLOW FILTERING;
否则,您可以通过选择限制性更强的条件将两个下限条件合并为一个条件:
select count(*) from notifications
where received_datetime >= '2016-10-18 00:00:00'
ALLOW FILTERING;