Skip to content
Advertisement

INNER/LEFT JOIN two tables and extend result with row [closed]

I have two tables which both have a row by the name “type”. It looks like this:

events:

types:

If “events.type” matches “types.type” I want to extend my query result with the label from types, so it looks like this:

combined:

How do I accomplish this? I assume I have to use INNER/LEFT JOIN, but the following attempt doesn’t give me any rows:


UPDATE

Wow.. Turned out there wasn’t a problem with the query at all. The reason it didn’t return any rows was because the “types” table had some illegal characters in the label rows 🙂

Advertisement

Answer

you miss one s on types.id

SqlFiddle Demo

OUTPUT

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement