![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have definitely not seen the part at the end where the sub-query is aliased as g, and then a parenthesized letter (y) is put at the end It appears that g.y becomes a column, but the syntax is confusing to me. Thanks, Bill snip ( SELECT DISTINCT ',' + CAST(SubID AS VARCHAR(11)) FROM @Sample AS s WHERE s.ID = i.ID ORDER BY ',' + CAST(SubID AS VARCHAR(11)) FOR XML PATH('') ) AS g (y) |
#3
| |||
| |||
|
|
I have definitely not seen the part at the end where the sub-query is aliased as g, and then a parenthesized letter (y) is put at the end It appears that g.y becomes a column, but the syntax is confusing to me. |
|
CROSS APPLY ( SELECT DISTINCT ',' + CAST(SubID AS VARCHAR(11)) FROM @Sample AS s WHERE s.ID = i.ID ORDER BY ',' + CAST(SubID AS VARCHAR(11)) FOR XML PATH('') ) AS g (y) |
#4
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |