On Tue, Jan 26, 2021 at 5:31 AM 'Michael Monerau' via sequel-talk <
[email protected]> wrote:

> Hi,
>
> Say I have `Artist` and `Album` models as in the doc, and they would be
> connected through a join table :albums_artists, and `many_to_many`
> associations.
>
> To filter artists with a specific album, I use `where(albums:
> Album.where(id: album_id))`.
>
> How do I write the dataset of Artists with no existing Album?
>

There are various approaches to doing this in SQL, so it depends on which
approach you want to use.  However, the simplest Sequel approach is
probably:

  exclude(albums: Album.dataset)

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSSfgrCj5qNfX1GwVdXVNSa%2Bn5EjwPMhAYeV2zFixPpj%2BAg%40mail.gmail.com.

Reply via email to