I am close to it but "order by" stops me:

  string_agg(Sequel.cast(Sequel[:dirs][: uid  ], :text), ',', 
                 Sequel.cast(Sequel[: dirs  ][:uid], :text)).distinct

On Thursday, February 25, 2021 at 6:24:51 AM UTC+3 [email protected] 
wrote:

> Hi Jeremy,
>
> I am bit lost for string_agg in PostgreSQL when converting to Sequel.
>
> How can I write this code with Sequel?
>
>      SELECT
>         "f"."id",
>         "f"."uid",
>         string_agg(distinct CAST (dirs.uid AS text), ',' order by CAST 
> (dirs.uid AS text)) as dirs_uids
>       FROM "paths" as "f"
>       JOIN dirs ON "f".id = dirs.folder_id
>       WHERE (paths.user_idx = 1)
>       GROUP BY "f".id, "f"."uid"
>       LIMIT 50
>
> Thanks,
> Dennis.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/e1299ca0-dd6d-45c8-b9e4-789eb5d344aan%40googlegroups.com.

Reply via email to