SELECT DISTINCT [OrderID],STUFF((SELECT ‘,’+[StopCauseName] FROM [表] WHERE OrderID = SQL3.OrderID FOR XML PATH(’’)),1,1,’’)AS Course
FROM [表] AS SQL3 where convert(varchar(10),dateadd(HH,-8,StartTime),120) = convert(varchar(10),@StartTimes,120)
SQL 字段用逗号分隔
最新推荐文章于 2024-01-11 15:16:07 发布