Hi Jeremy,
Based on my previous question, how do you use Sequel Models when FROM
contains distinct?
class Email < Sequel::Model; end
SELECT
name,
string_agg(user_id::text, ',' order by ordering desc)
FROM (
SELECT DISTINCT ON (em.id, c.user_id)
*
FROM emails em
JOIN contacts c ON c.email_id = em.id
) s
GROUP BY name
Because, when Email used, FROM becomes "emails"...
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/29ae6486-1a7a-455f-be79-bd03d8100ba8n%40googlegroups.com.