Till Westmann | fd733ee | 2014-07-10 00:57:37 -0700 | [diff] [blame] | 1 | use dataverse TinySocial; |
2 | |||||
3 | for $user in dataset MugshotUsers | ||||
4 | let $result := { | ||||
5 | "uname" : $user.name, | ||||
6 | "msg-length" : avg( | ||||
7 | for $message in dataset MugshotMessages | ||||
8 | where $message.author-id = $user.id | ||||
9 | return string-length($message.message) | ||||
10 | ) | ||||
11 | } | ||||
12 | order by $result.msg-length desc | ||||
13 | limit 10 | ||||
14 | return $result; |