I have a table
CREATE TABLE userssbyprofit (
userid text,
profit double,
dateupdated timeuuid,
PRIMARY KEY (userid, profit, dateupdated)
) WITH CLUSTERING ORDER BY (profit DESC, dateupdated DESC)
Userid can be used to lookup the full user details in another table. This table will provide a history of the users profits. Taking the most recent one to find their current profit amount.
How do I retrieve the 10 most profitable users with their profit amount. I want it to be distinct based on the userID
Thanks.
You need to create one more table or view which have only user id and profit . New table or view will have user id order by profit with desc order .