Peng
Peng

Reputation: 345

Redis - Get the aggregated score from three sorted set

i have three sorted sets:

setA {play1: 100, play2: 150, play3: 230} setB {play1: 120, play4: 100, play5: 200} setC {play1: 110, play3: 150, play5: 30}

Is it possible to get an aggregated result (sum the score for the same user in different sets and display all of users scores in the result) of the three sorted sets?

thanks!

Upvotes: 1

Views: 293

Answers (1)

Matthias Winkelmann
Matthias Winkelmann

Reputation: 16394

ZUNIONSTORE setSetSetAllMySets 3 setA setB setC AGGREGATE sum

sum happens to be the default aggregation and therefore isn't strictly necessary. I just wanted to get you interested in what other aggregations are available.

http://redis.io/commands/zunionstore

Upvotes: 2

Related Questions