string_agg(context,',') as contexts from student group by name; 需要注意的是,string_agg 这个函数只能在 postgres 9.0 以上的版本中使用,因为 postgres 9.0 一下的版本中,并没有提供这一个函数,需要我们自己去实现。 一种实现方式是:使用 arr_agg 的函数来实现聚合,不过返回的类型是 Array,然后我们再通过...