杨魅力
你的第一个图是 是数据库的原始数据 还是你写查询语句进行的处理过的数据 如聚合函数?如果数据库表的数据是这样的话 下面的sql语句select showtime,isnull(sum(unknow),0) as unknow ,isnull(sum(noidea),0) as noidea ,
isnull(sum(soso),0) as soso,isnull(sum(understand),0) as understand
from
(select showtime,case when reason='不明白' then Amount end unknow,
case when reason='不清楚' then Amount end noidea,
case when reason='还好' then Amount end soso,
case when reason='了解' then Amount end understand
from test1 group by showtime,reason,Amount) as temp
group by showtime
--表test1 你可以替换为 你的查询语句查询结果 showtime unknow noidea soso understand
----------------------- ----------- ----------- ----------- -----------
2012-01-12 00:00:00.000 0 0 5 4
2012-02-10 00:00:00.000 3 0 0 0
2012-11-18 00:00:00.000 2 3 0 3
2012-12-21 00:00:00.000 0 1 0 0你应该把的表结构 给说出来 而不是你查出来的数据 我还纠结哪有这样建表的啊