I would like to extract data from SQL table differently than how it is defined:
The table t_Plants has two columns where the first column is a hydro generator ID and the second column refers to the downstream hydro generator ID.
Plant_ID    Downstream_ID
1           3
2           3
3           4
4           6
5           6
6           NULL
I would like to write a query that gives me upstream generator the following output (since there are possibly more than 1 upstream reservoirs, the UpStream_Lkup is a some sort of a list:
Plant_ID     UpStream_Lkup    
 3            1,2    
 4            3   
 6            4,5
Thanks for the help
 
    