开发者

Cross PDO driver compatible GROUP_CONCAT?

开发者 https://www.devze.com 2023-04-07 14:36 出处:网络
Is th开发者_运维技巧ere an efficient alternative to GROUP_CONCAT that works in the major PDO drivers?Given this MySQL:

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

精彩评论

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