I've achieved same with following code:
string_agg(Sequel.cast(Sequel[:dirs][:uid], :text),
Sequel.lit("',' ORDER BY ?", Sequel.cast(Sequel
[:dirs][:uid], :text)))
Please do let me know if there is a better way than this.
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/bc36353c-0738-4c00-8b1a-438b8ea0c96en%40googlegroups.com.