Lets say I have a table where we log activities of user, I need to find out created_at of the 1000th activity of each user..
Following query works fine for one user..
select `created_at` from `user_activity` where `user_id` = 2 order by `created_at` limit 1 offset 1000
But how do i run it for all users..
I have tried
where user_id in (select DISTINCT(user_id) from user_activity)
OR
GROUP BY user_id