I have two tables as in the below diagram and I want to perform a join on them. The first table contains events, and the second table contains attributes for those events.
I want to write a query that will join the two tables below and create the output on the bottom.
Is this possible in MySQL? This question is very hard to google for (or even come up with a title for!), so I apologize if it is a duplicate.
Right now, I have this:
SELECT *
FROM events e LEFT JOIN event_attributes ea ON e.id = ea.event_id
WHERE e.id = 1;
Which produces 2 rows, one with time_opened and one with time_closed.
EDIT: I want this to be dynamic so I can add as many attributes as I want and the name becomes the header for the column and the value becomes the rows's value.