Cross PDO driver compatible GROUP_CONCAT?
Is th开发者_运维技巧ere an efficient alternative to GROUP_CONCAT
that works in the major PDO drivers?
Given this MySQL:
select group_concat(c separator ',') from t
you could do this in PostgreSQL:
select array_to_string(array_agg(c), ',') from t
or this in SQLite:
select group_concat(c, ',') from t
I don't know about SQL Server though.
References:
- MySQL
group_concat
- PostgreSQL
array_agg
- PostgreSQL
array_to_string
- SQLite
group_concat
精彩评论