On Thursday, March 17, 2016 at 3:11:36 AM UTC+1, [email protected] wrote:
>
>
>
> I can come up with something too complicated to my taste using subqueries 
> (one subquery per label), but I wondered if sequel had a simpler way.
>

Forgot to mention what I came up with:

      
          labels = ['foo', 'bar']
          @assets = Asset.where(...)
          labels.each do |l|
            lbl = Label.where(name: l).select(:id)
            ids = DB[:assets_labels].where(label_id: lbl).select(:asset_id)
            @assets = @assets.where(id: ids)
          end 

-- 
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.

Reply via email to