select stuff((select ','+w.Waybillno from Web_Way_Waybill w where w.IsValid<>'Y' AND w.TruckOrder='T1712220007' FOR XML PATH('')),1,1,''))+ left(',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
(59- (select len(( select stuff((select ','+w.Waybillno from Web_Way_Waybill w
where w.IsValid<>'Y' AND w.TruckOrder='T1712220007' FOR XML PATH('')),1,1,'')) )-len(replace(
(select stuff((select ','+w.Waybillno from Web_Way_Waybill w where w.IsValid<>'Y' AND w.TruckOrder='T1712220007' FOR XML PATH('')),1,1,'')) ,',','')))))
as Waybillnostr,

05-11 15:11