Moatez Bouhdid Moatez Bouhdid - 3 months ago 6
SQL Question

Join three tables into a join table

I have three entities with Many-To-Many relationship between all of them

User
,
Project
and
Task
. I want to join the three tables into one table
collaborator
that contains only the IDs of the three tables.

But I don't understand how can I join them with
@JoinTable
plus how can I manage the cascade Types.

Any help would be appreciated.Thanks
P.S: if there's any other idea it's welcome.

Answer

You can select from dinamic temp table

select * from (
    select user.id, Project.id, Task.id
    inner join Project on user.join_key = Project.join_key
    inner join  Task  on task.join_key = = Project.join_key
) collaborator
Comments