Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. ProjectId |
  2. -----------+
  3. 1 |
  4. 2 |
  5. 3 |
  6.  
  7. ResourceId | Label | ProjectId
  8. -----------+---------------+-----------
  9. 2 | Resource X | 1
  10. 3 | Resource Y | 1
  11. 4 | Resource Z | 2
  12. 5 | Resource A | 2
  13. 6 | Resource X | 3
  14.  
  15. ProjectId | Label |
  16. -----------+--------------------------+
  17. 1 | Resource X, Resource Y |
  18. 2 | Resource Z, Resource A |
  19. 3 | Resource X |
  20.  
  21. CREATE TABLE #tmpProjects
  22. (
  23. ProjectId INT
  24. , Label VARCHAR(1000)
  25. )
  26.  
  27. SELECT [P].ProjectId, [PR].Label
  28. INTO #tmpProjects
  29. FROM [MySchema].[ProjectResources] [PR]
  30. INNER JOIN dbo.Project [P] ON [P].ProjectId= [PR].ProjectId
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement