I have written following code in Mysql. But now I want to run this same code in MS-SQL server. How do I do that?! I dont know some syntax in MS-SQL.
Code:
select
t2.gname
from
(select
sum(t1.strength) as sst,
group_concat(t1.name order by t1.name) as gname
from
(select
a.name,
a.strength,
group_concat(d.zone order by d.zone) as zones
from Animals a
inner join Details d on a.id = d.id
group by a.id) t1
group by t1.zones) t2
order by t2.sst desc limit 1;
I got the correct output in MySQL. But how I can change it for MS-SQL?
Please help! Note question pertaining to this solution is : Problem statement