Please suggest me to frame the query without using the STRING_AGG function
Scenarios are attached - PFA