業務で「文字列を集計する関数」を使う機会があったので、その使い方をまとめます。 配列にピボットされた入力値を返します。 入力が空の場合、関数は空の配列を返します。 ARRAY_AGG( [ DISTINCT ] <expr1> ) [ WITHIN GROUP ( <orderby_clause> ) ] ・expr1:配列に入れる値 ...
-- Objective: Collect top product names per department into arrays. -- Data/location: thelook_ecommerce.products (US). -- Expected result: One ordered three-name array per department. -- Standard ...
select u.id, jsonb_agg(p.*) as posts from users u left join posts p on p.user_id = u.id group by u.id ...
一部の結果でアクセス不可の可能性があるため、非表示になっています。
アクセス不可の結果を表示する