I have two tables: organization and journey_alias
the organization table has the following columns: organization_id, slug
the journey_alias table has the following columns: organization_id, url, created_at, user_id
I'd like to return the following
user_id, slug, created_at, url (only returning the most recently created url for each user).
Here's what i've tried:
SELECT journey_alias.url, journey_alias.user_id, organization.slug,
MAX(journey_alias.created_at) AS "mostrecent"
FROM journey_alias
INNER JOIN organization ON journey_alias.organization_id=organization.organization_id
GROUP BY journey_alias.user_id
I see answers that solves for 1 table, but I can't find how to do this when there are 2 tables. Any help is much appreciated, thanks!