查询一张表中,点号不同,在时间相同的数据,并展示时间,水位,雨量,流量,开度等语句。
select forecastt,
max(case when dataid=2124000 then forecastv else 0 end) as v1,
max(case when dataid=2224000 then forecastv else 0 end) as v2,
max(case when dataid=2324000 then forecastv else 0 end) as v3,
max(case when dataid=2424000 then forecastv else 0 end) as v4
from Ad_FcDeploy where spanId=1
group by forecastt order by forecastt
特此留下标记,以便自己记忆。