I have one table in Cassandra :-
CREATE TABLE printerload (
gp_date timestamp,
printed_cost float,
printed_pages int,
saved_cost float,
saved_pages int,
PRIMARY KEY (gp_date)
)
I have inserted data in the table :-
cqlsh> select * from ga.printerload;
gp_date | printed_cost | printed_pages | saved_cost | saved_pages
--------------------------+--------------+---------------+------------+-------------
2012-01-02 10:30:00-0800 | 0.2 | 2 | 0 | 0
2013-07-10 11:30:00-0700 | 22633 | 322304 | 54.72 | 142
2012-12-15 10:30:00-0800 | 952.17 | 13524 | 0.18 | 3
2013-01-25 10:30:00-0800 | 1982.2 | 26006 | 0.66 | 0
2013-02-26 10:30:00-0800 | 23189 | 335584 | 61.44 | 84
2012-07-16 11:30:00-0700 | 25312 | 338318 | 13.16 | 25
2012-09-26 11:30:00-0700 | 19584 | 287148 | 98.64 | 319
2012-02-09 10:30:00-0800 | 5.01 | 33 | 0.12 | 0
2012-08-19 11:30:00-0700 | 21833 | 323918 | 28.42 | 395
2013-05-09 11:30:00-0700 | 16493 | 235701 | 30.27 | 232
2013-06-14 11:30:00-0700 | 681.41 | 9087 | 0 | 0
2012-08-04 11:30:00-0700 | 610.91 | 8533 | 0 | 0
2012-06-04 11:30:00-0700 | 22793 | 317440 | 4.09 | 4
2013-07-30 11:30:00-0700 | 22037 | 322377 | 34.83 | 79
2012-08-20 11:30:00-0700 | 22760 | 334601 | 8.48 | 17
I want to search on the basis of date (I am inserting data using Java client, where gp_date is only date, e.g. 2013-07-30). I did a query :-
cqlsh> select * from ga.printerload WHERE gp_date = '2013-07-30';
(0 rows)
I need to include time part as well to search.
cqlsh> select * from ga.printerload WHERE gp_date = '2013-07-30 11:30:00-0700';
gp_date | printed_cost | printed_pages | saved_cost | saved_pages
--------------------------+--------------+---------------+------------+-------------
2013-07-30 11:30:00-0700 | 22037 | 322377 | 34.83 | 79
But the comparison should be only on the basis of date (I want to get records for a specific day, irrespective of time). How can I do that? Is there any method which can compare only date part? I am using Apache Cassandra 2.0.7.