34,594
社区成员
发帖
与我相关
我的任务
分享
select
[缩合],
[78#],
sum(case when [fcombobox4]='1月' then fdecimal else 0 end) as [一月],
sum(case when [fcombobox4]='2月' then fdecimal else 0 end) as [二月],
sum(case when [fcombobox4]='3月' then fdecimal else 0 end) as [三月],
sum(case when [fcombobox4]='4月' then fdecimal else 0 end) as [四月],
sum(case when [fcombobox4]='5月' then fdecimal else 0 end) as [五月],
sum(case when [fcombobox4]='6月' then fdecimal else 0 end) as [六月],
sum(case when [fcombobox4]='7月' then fdecimal else 0 end) as [七月],
sum(case when [fcombobox4]='8月' then fdecimal else 0 end) as [八月],
sum(case when [fcombobox4]='9月' then fdecimal else 0 end) as [九月],
sum(case when [fcombobox4]='10月' then fdecimal else 0 end) as [十月],
sum(case when [fcombobox4]='11月' then fdecimal else 0 end) as [十一月],
sum(case when [fcombobox4]='12月' then fdecimal else 0 end) as [十二月]
from
[t_BOS200002318] a
join
[t_BOS200002318entry] b
on
a.fid=b.fid
group by
[缩合],[78#]
select '缩合' , '78#' , fdecimal as 一月 from t_BOS200002318,t_BOS200002318entry
where t_BOS200002318.fid=t_BOS200002318entry.fid and t_BOS200002318.fcombobox4='1月'
union all
select fdecimal4 as 二月 from t_BOS200002318,t_BOS200002318entry
where t_BOS200002318.fid=t_BOS200002318entry.fid and t_BOS200002318.fcombobox4='2月'
union all
select fdecimal4 as 三月 from t_BOS200002318,t_BOS200002318entry
where t_BOS200002318.fid=t_BOS200002318entry.fid and t_BOS200002318.fcombobox4='3月'