varsqlStr="select monitorName,\r\n ip,\r\n title,\r\n CONVERT(varchar,max(t.进水温度)) as tempreture,\r\n CONVERT(varchar,MAX(t.出水温度)) as humidity,\r\n CONVERT(varchar,ROUND((MAX(t.出水温度) - MAX(t.进水温度)), 2)) as illuminance\r\nfrom (select Left(a.monitorName, len(a.monitorName) - 4) as monitorName,\r\n Right(a.monitorName, 4) as monitorType,\r\n a.ip,\r\n a.title,\r\n ROUND(b.tempreture+a.repair_value,2) as tempreture,\r\n a.monitorOrder\r\n from (\r\n select t1.title,\r\n t2.ledId,\r\n t1.ip,\r\n t2.monitorId,\r\n t2.monitorOrder,\r\n t3.monitorName,t2.repair_value,\r\n MAX(t4.collectTime) as collectTime\r\n from T_Led_Info t1\r\n left join T_Led_MonitorUnit t2 on t1.ledId = t2.ledId\r\n left join T_Monitor t3 on t2.monitorId = t3.monitorId\r\n left join T_W_TempertureData t4 on t4.monitorId = t3.monitorId\r\n where t1.title = @titleName \r\n group by t1.title, t2.ledId, t1.ip, t2.monitorId, t3.monitorName, t2.repair_value,t2.monitorOrder\r\n ) as a\r\n left join T_W_TempertureData b on b.collectTime = a.collectTime and a.monitorId = b.monitorId) as s1\r\n pivot (max(tempreture) for monitorType in (进水温度,出水温度)) t\r\ngroup by monitorName, ip, title, monitorOrder\r\norder by monitorOrder";