On Friday, June 22, 2018 at 7:33:45 AM UTC-7, craig buchanan wrote:
>
> SELECT e.*
> FROM entities e
> WHERE EXISTS(
> select 1
> from opportunities
> where client_entity_id=e.id or agent_entity_id=e.id
> )
>
>
>
Here you go (this uses IN instead of 2 = operators, but should result in
the same behavior):
DB[Sequel[:entities].as(:e)].
select_all(:e).
where(DB[:opportunities].
select(1).
where{{e[:id] => [:client_entity_id, :agent_entity_id]}}.
exists)
Thanks,
Jeremy
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.