V8-archive: Join two or more table data into one collection

Created on 9 Dec 2019  路  5Comments  路  Source: directus/v8-archive

Feature Request

mysql left join-like feature
in my case i have a user table, which regroups data like :birthdate, name, firstname, email address,...., and i have an address table which store, address line1, 2, zip code, city, [state], and userID(which obviously links back to the user from the user table whom uses this address).
I would basically like to know if it is possible to get if i could have a collection where all data from a user can be displayed(where all the table i want are displayed for this specific user:
name_userA,firstname_userA, birthdate_userA,...,
<- user table| address table ->addressLine_userA, city_userA, ...)

What problem does this feature solve?

Having all information on a user based on id(which is linked to other table(s) as a pointer) displayed on a dedicated collection

How do you think this should be implemented?

Would you be willing to work on this?

question

All 5 comments

Yes, this is possible in the API now... you would create a relationship between the collections. Probably a O2M or M2M in this case:

https://docs.directus.io/guides/relationships.html#many-to-one

Also, this would be a nice thing to have in the App too. Right now this data would be displayed as links to the other relational data/items... but having that relational form inline would be nice too. If @rijkvanzanten likes this idea, I'll open a Feature Request on the App.

@benhaynes A o2m / m2m that renders the related items inline is the relational repeater 馃槈

True!! Might be nice for it to render inline a bit more "seamlessly" when used on a O2M since there will be no repeating. 馃憤

I think you're confusing your O2Ms with the M2Os @benhaynes. An O2M _does_ repeat, as does a M2M.

I use them interchangeably, since it just depends on the direction of the relationship. Yes, the repeater would work well for O2M and M2M... but I guess I was talking about a M2O on my original idea. That would allow you to manage relational data on the parent item _directly_. Same concept... just different parent/direction.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

binary-koan picture binary-koan  路  3Comments

cdwmhcc picture cdwmhcc  路  3Comments

Nitwel picture Nitwel  路  3Comments

maettyhawk picture maettyhawk  路  3Comments

metalmarco picture metalmarco  路  3Comments