[英]Cassandra CQL: Filter the rows between a range of values
我的專欄族的結構有點像
CREATE TABLE product (
id UUID PRIMARY KEY,
product_name text,
product_code text,
status text,//in stock, out of stock
mfg_date timestamp,
exp_date timestamp
);
二級索引是在status,mfg_date,product_code和exp_date字段上創建的。
我想選擇狀態為IS(有貨)且制造日期在時間戳xxxx到xxxx之間的產品列表。
所以我嘗試了以下查詢。
SELECT * FROM product where status='IS' and mfg_date>= xxxxxxxxx and mfg_date<= xxxxxxxxxx LIMIT 50 ALLOW FILTERING;
它會引發錯誤,例如使用“等於”運算符的by-columns子句中不存在索引列 。
我需要更改結構嗎? 請幫幫我。 提前致謝。
cassandra不支持> =,因此您必須更改值,並且必須僅使用>(大於)和<(小於)來執行查詢。
在where子句的索引或主鍵列字段之一上,至少應有一個“等於”運算符,即“ mfg_date = xxxxx”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.