I am on a postgres database
So I have a raw sql query like the following I intend to use to query the database
Select
acts.created_at as "firstActivity",
users.*
from users
join activities acts on acts.user_id = users.id
and acts.created_at > users.created_at
and acts.created_at < users.updated_at
where users.region_id='1'
the problem is that there are multiple activities in between the user's creation and update. The created_at and updated_at fields are of course dates like the following 2021-11-10 09:27:14+00
I would like to only return the first activity of those activities between the two times.