Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 100

Collapse one to many into one SQL query result row - forum topic by 808healthcare

$
0
0

I would like to collapse records from a one to many relationship down into a single query result row, a task can have one or two resources assigned (there is no limit on the number of resources that can be assigned but for this exercise let’s say the number can never be zero or more than two)
 
Task Table
Task_ID                  Resource_ID
123                         444
123                         555
678                         999
 
Resource Table
Resource_ID           Resource_Name
444                         Pat
555                         Chris
999                         Sam
 
Ideally I would like my query result to return the following:
Task_ID                  Resource1           Resource2
123                         Pat                      Chris
678                         Sam

Forums: 

Viewing all articles
Browse latest Browse all 100

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>