Question: For example, in `redis-cli` I've tried to create a sorted set like this:

```
zadd sortedset 1 1 2 2 3 3

```

And I've created a hash like this:

```
hset data 1 hello 
hset data 2 goodbye
hset data 3 sir

```

My goal is storing identifiers in sorted sets and get strings stored in `data` hash sorted by the sorted set ordering.

This is what I've tried so far:

```
sort sortedset by nosort get data->*

```

...which outputs:

```
1) (nil)
2) (nil)
3) (nil)

```

Actually I was expecting that `*` wildcard should be one of identifiers stored in the so-called sorted set, but it seems like it doesn't perform the substitution to each concrete identifier in the sorted set.

Am I trying to solve the issue in the right way or is there another approach to solve this?

Answer: 
Essentially, you are right but the current implementation of the `SORT` command only accepts wildcards on the left side of the hash dereference (see `lookupKeyByPattern` in `sort.c`). That being the way it is atm, instead of `SORT`, use a Lua script to this. For example, here's a dirty quick one:

```
$ redis-cli eval "return redis.call('HMGET', KEYS[2], unpack(redis.call('ZRANGEBYSCORE', KEYS[1], '-inf', '+inf')))" 2 sortedset data
1) "hello"
2) "goodbye"
3) "sir"

```
I've found that it's an use case that's not actually covered by Redis for now.

Anyway, there's an alternate approach: a combination of sorted sets and `hmget`.

If I store identifiers in a sorted set and **I get them using rank ranges with `zrange`, it's easy to get paged results from a hash using `hmget` giving multiple hash keys.**