buyingyi | 2fd7fa6 | 2014-11-24 19:31:55 -0800 | [diff] [blame] | 1 | from $event in dataset('Event') |
| 2 | from $sponsor in $event.sponsoring_sigs |
| 3 | with $es := { "event": $event, "sponsor": $sponsor } |
| 4 | group by $sig_name := $sponsor.sig_name with $es |
| 5 | with $sig_sponsorship_count := count($es) |
| 6 | with $by_chapter := |
| 7 | from $e in $es |
| 8 | group by $chapter_name := $e.sponsor.chapter_name with $es |
| 9 | select { "chapter_name": $chapter_name, "escount" : count($es) } |
| 10 | order by $sig_sponsorship_count desc |
| 11 | limit 5 |
| 12 | select { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter } |