Questions tagged «array-agg»

2
PostgreSQL array_agg命令
表“动物”: animal_name animal_type Tom Cat Jerry Mouse Kermit Frog 查询: SELECT array_to_string(array_agg(animal_name),';') animal_names, array_to_string(array_agg(animal_type),';') animal_types FROM animals; 预期结果: Tom;Jerry;Kerimt, Cat;Mouse;Frog OR Tom;Kerimt;Jerry, Cat;Frog;Mouse 我可以确定第一个聚合函数中的顺序将始终与第二个相同。我的意思是我不想得到: Tom;Jerry;Kermit, Frog;Mouse,Cat
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.