开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜