You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say I need to fetch all users (with pagination -- offset + limit), along with a count of each user's "form" count -- in SQL, I'd do something like this:
SELECT *, (SELECT COUNT(*) FROM `Forms` WHERE UserId = Users.id) FROM `Users` LIMIT 10;
How can I achieve the same thing, using db.User.findAndCountAll({ limit: 10 }) ?
You can count users with limit. But it's not currently possible to count associations with a limit. You can however count both users and associations without a limit using some custom attributes.
Activity
mickhansen commentedon Jan 7, 2014
You can count users with limit. But it's not currently possible to count associations with a limit. You can however count both users and associations without a limit using some custom attributes.