简体   繁体   中英

Query for records with overlapping dates in cassandra

Given a table with startDate and endDate columns how do I query for records where the periods overlap. The dates currently use DateField type. Would changing the type to DateRangeField help with this query? We are using Cassandra with Solr.

i am just sharing a data model for records where the periods overlap event

CREATE TABLE event (      
start_date date,
id timeuuid,
end_date date,
PRIMARY KEY ((start_date), id))

SELECT * FROM event WHERE start_date =date;

i think if you create your data model like this and query like this your problem will be solve.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM