MS SQL数据库通过时间筛选查询。多行数据通过列显示数据:
数据库表:
最后查询出表格式:
查询语句怎么修改:
select * from ABCD where POINTTIME<='2018-10-11 00:00' and POINTTIME>='2018-10-10 00:00
MS SQL数据库通过时间筛选查询。多行数据通过列显示数据:
数据库表:
最后查询出表格式:
查询语句怎么修改:
select * from ABCD where POINTTIME<='2018-10-11 00:00' and POINTTIME>='2018-10-10 00:00
select ABCD.时间,
sum(case ABCD.变量名 when 'A' then ABCD.数据 else 0 end),
sum(case ABCD.变量名 when 'B' then ABCD.数据 else 0 end),
sum(case ABCD.变量名 when 'C' then ABCD.数据 else 0 end),
from ABCD
where POINTTIME <= '2018-10-11 00:00'
and POINTTIME >= '2018-10-10 00:00'