Peter_175 Peter_175 - 25 days ago 10
Ruby Question

posgres, find 3 top student in multi weekend

I have table

top_student_weekends
students:text[]
date:timestamp


in weekend 1: id:1, students:[1,2,3,4,5], date:2016-11-05

in weekend 2: id:2, students:[1,3,4,5,9], date:2016-11-12

in weekend 3: id:3, students:[1,4,5,9,10], date:2016-11-19

Result I want to get top 3 top students: 1,4,5

Is it possible to write this to query?

Answer

Yes, it is possible to write that query.