0

I have a table structure

CREATE TABLE user_location_by_date(
    user_id int,
    date text,
    time timeuuid,
    lat float,
    lng float,
    PRIMARY KEY((user_id, date),time)
)

When I try to run this query

select * from user_location_by_date where user_id=1 order by time desc limit 1;

I get this error

Partition key parts: date must be restricted as other parts are

I suppose to use where user_id=1 and date= in order to able run the query. If i dont know when is the location last inserted date. How I can get the latest location of the user?

Calvin
  • 605
  • 10
  • 26
  • Thank you @Evan I get some nice info on that question link, Maybe I should try to query by date > 1 year before and date <1 year before ? – Calvin Aug 03 '17 at 02:50
  • 1
    https://stackoverflow.com/questions/29654067/cassandra-partial-partition-key?noredirect=1&lq=1 – Calvin Aug 03 '17 at 02:53

0 Answers0