chakey 发表于 2013-1-30 01:31:32

MySQL中group_concat()在PostgreSQL中的实现

MySQL中经常使用到GROUP_CONCAT()这个函数,在Pg中可以通过数组来实现:



pgd=# create aggregate group_concat (anyelement)
(
sfunc = array_append,
stype = anyarray,
initcond='{}'
);


这样句式结构可以和MySQL的一样:
SELECT userid,group_concat(book_count) as bcn FROM book_test_table ;
页: [1]
查看完整版本: MySQL中group_concat()在PostgreSQL中的实现