Ah - apparently I can't edit. So, a better set of data:

ID 1 - Type "Dog" - Birthday "1-31-18"
ID 2 - Type "Dog" - Birthday "2-31-18"
ID 3 - Type "Cat" - Birthday "2-31-18"
ID 4 - Type "Dog" - Birthday "3-31-18"
ID 5 - Type "Cat" - Birthday "4-31-18"
ID 6 - Type "Frog" - Birthday "5-31-18"
ID 7 - Type "Dog" - Birthday "6-31-18"
ID 8 - Type "Frog" - Birthday "6-31-18"

Specifically, the challenge I'm having is figuring out how to set a 
restriction to only return entries if there's specifically a dog AND cat 
that share that birthday.

On Wednesday, January 31, 2018 at 1:45:01 PM UTC-8, Max Farrar wrote:
>
> Say I have a model Animal, which has a string 'type', and a time 
> 'birthday'.
>
> I want to get a list of only birthday times where there's both a type 
> 'dog' and a type 'cat' with birthdays at the time. Is there an optimized 
> way to do this using a single Sequel command?
>
> Direct example of data:
>
> ID 1 - Type "Dog" - Birthday "1-31-18"
>
> ID 2 - Type "Dog" - Birthday "2-31-18"
>
> ID 3 - Type "Cat" - Birthday "2-31-18"
>
> ID 4 - Type "Dog" - Birthday "3-31-18"
>
> ID 5 - Type "Cat" - Birthday "4-31-18"
>
>
>
> I'd want to return a list including ID's 2 and 3 only.
>

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