Hi,
please, can you suggest how to to add count on grouped dataset using models?

This
User.join(DailyLog,:user_id=>:id).group_and_count(:user_id).select_all.
select_append{sum(sum).as(cals)}

translates to:
SELECT *, sum(`sum`) AS 'cals' FROM `users` INNER JOIN `daily_logs` ON (
`daily_logs`.`user_id` = `users`.`id`) GROUP BY `user_id`


and im trying to achieve:
SELECT *, sum(`sum`), count(*) AS 'cals' FROM `users` INNER JOIN 
`daily_logs` ON (`daily_logs`.`user_id` = `users`.`id`) GROUP BY `user_id`

Thank you

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