When creating a [[view]] in [[Google Sheets]], you may want to create a column that includes all values from a [[many-to-many relationship]]. Let's say you have a list of `activities` in column A and a many-to-many table in the sheet `people_activities` where column `A` has people's names and column `B` has the activity identifier. ## Using QUERY You can use a `QUERY` to return a [[dynamic range]] of all matching records and then `JOIN` those records with a delimiter (I recommend avoiding the comma since that can be confusing if the sheet is exported as a CSV). ``` =JOIN(" | ", IFNA(QUERY(people_activities!A:B, "SELECT A WHERE B IS NOT NULL AND B='"&A2&"'", 1))) ``` Because a `QUERY` with no results returns `#N/A`, we catch the empty condition with `IFNA()`. ## Using FILTER An equivalent formulation uses `FILTER` instead of QUERY. ``` =JOIN(" | ", IFNA(FILTER(people_activities!B:B, people_activities!A:A=A2, NOT(ISBLANK(people_activities!B:B)))) ```