62,267
社区成员
发帖
与我相关
我的任务
分享
SqlConnection con = new SqlConnection("server=localhost;database=7daydian;uid=sa;pwd=1234");
string dia = "dianliang";
string sql = "select '"+dia+"' from tongji order by shijian";
SqlCommand com = new SqlCommand(sql, con);
select distinct [name] as 板块名称 ,[num1] as [周一],[num2] as [周2],[合计] from (select [name],[zhuzhai2],riqi,[合计]=sum([zhuzhai2])over(partition by [name]) from vw_rp_plan_houseitem where riqi>=''and dep_master_Nod='1' and BossNod='1' ) a pivot (max([zhuzhai2]) for [riqi] in( [num1] as [周一],[num2]as [周2]))b
string sql = "select distinct [name] as 板块名称,[" + mon + "] as [周一]" +
",[" + thur + "] as [周2],[合计] from (select [name],[zhuzhai2],riqi,[合计]=sum([zhuzhai2])over(partition by [name]) from vw_rp_plan_houseitem where riqi>='' and dep_master_Nod='1' and BossNod='1') a pivot (max([zhuzhai2]) for [riqi] in( [" + mon + "] as [周一],[" + thur + "] as [周2])) b ";
string sql = "select distinct [name] as 板块名称 ,[" + mon + "]as [周一]
,[" + thur + "]as [周2]
,[合计] from (select [name],[zhuzhai2],riqi,[合计]=sum([zhuzhai2])over(partition by [name]) from vw_rp_plan_houseitem where riqi>=''and dep_master_Nod='1' and BossNod='1' ) a pivot (max([zhuzhai2]) for [riqi] in( [" +mon+ "]as [周一],[" + thur + "]as [周2]))b ";

string sql = 'select "+dia+" from tongji order by shijian';