Hey Jeremy. Thank you so much for the quick help.

It just worked.

Gencer.

On Sunday, February 18, 2018 at 11:48:06 PM UTC+3, Jeremy Evans wrote:
>
> On Sunday, February 18, 2018 at 12:15:21 PM UTC-8, Gencer W. G. wrote:
>>
>> Hi Jeremy,
>>
>> I have to count how many objects in the database by month. I am currently 
>> using this query (as raw):
>>
>> select count(*), date_trunc( 'month', created_on ) from objs group by 
>> date_trunc( 'month', created_on );
>>
>>
>> Is there any helper in Sequel that helps me on grouping objects by month 
>> and retrieve the data? If no how can I properly write above statement in 
>> Sequel?
>>
>
> You can probably do what you want via:
>
>   DB[:objs].group_and_count{created_on.extract(:month)}
>
> 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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
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