From a previous post, I have the following view in sqlite3:
CREATE View AttendeeTableView AS
SELECT (LastName || " " || FirstName) as AttendeeName,
CompanyName,
PhotoURI,
CompanyAttendeeRelation.CompanyId,
CompanyAttendeeRelation.AttendeeId
FROM Attendee
JOIN CompanyAttendeeRelation on CompanyAttendeeRelation.AttendeeId = Attendee.AttendeeId
ORDER BY LastName;
Now, since the data is generated from a many-to-many relation between Attendee
and Company
, I can get results such as:
Doe John | company A | johnPic.png | 1 | 15
Doe John | company B | johnPic.png | 2 | 15
What I'd like to do is, in cases where there's more than one company (like above), create a query that outputs:
Doe John | company A company B | johnPic.png | 1 2 | 15
And another that outputs:
Doe John | company A | company B | johnPic.png | 1 | 2 | 15
So I need to know essentially how to merge a specific column for rows that have different values in that table.
Any ideas?
Just in case, company A company B
in the first query is obviously text concatenation, That is, something along the lines of (row1.CompanyName || " " || row2.CompanyName)