Skip to content
Advertisement

SQL select only one row from second table JOIN

I have the following tables

Channel | id | name | descr |

channel_user

| channel_id | user_id |

channel_text

| channel_id | text_id |

text

| id | text | time

I am trying to retrieve all channels a user is subscribed to along with the last time a channel has received a text (by user). example: | id | name | descr | lastUpdate

So far I have the following

Advertisement

Answer

If I understand correctly, you need the JOIN between channel_text and text in the subquery. Also there is no u table in your query, but it is not needed:

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