select id,keyword ,max(Confidence) as confidence, TimeRange=stuff((select ‘,‘+rtrim(begintime)+‘-‘+rtrim(endtime) from tb where id=a.id and keyword=a,keyword for xml path(‘‘)),1,1,‘‘) from tb a group by id,keyword
时间: 2024-10-12 23:18:57
select id,keyword ,max(Confidence) as confidence, TimeRange=stuff((select ‘,‘+rtrim(begintime)+‘-‘+rtrim(endtime) from tb where id=a.id and keyword=a,keyword for xml path(‘‘)),1,1,‘‘) from tb a group by id,keyword