色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

第一行顯示日期怎么在第二行開始統計數量

江奕云2年前12瀏覽0評論

第一行顯示日期怎么在第二行開始統計數量?

set nocount on SELECT CASE WHEN GROUPING(v1.Fdate)=1 THEN 1 ELSE 0 END AS Fdate_Grouping,

CONVERT(varchar,v1.Fdate) AS Fdate_NOGrouping,

CASE WHEN GROUPING(v1.Fdate)=1 THEN 101

ELSE 0 END AS FSumSort ,SUM(CASE WHEN t4.FName ='(河南)散戶' THEN IsNull(u1.Fauxqty,0) ELSE 0 END) AS Fauxqty1,

SUM(CASE WHEN t4.FName ='(華東)華潤萬家有限公司' THEN IsNull(u1.Fauxqty,0) ELSE 0 END) AS Fauxqty2,

SUM(CASE WHEN t4.FName ='(華南)華潤萬家有限公司' THEN IsNull(u1.Fauxqty,0) ELSE 0 END) AS Fauxqty3,

SUM(IsNull(u1.Fauxqty,0)) AS Fauxqty281, IDENTITY(int,1,1) AS column_name into #CrossTab FROM ICStockBill v1 Inner Join ICStockBillEntry u1 on v1.FInterID=u1.FInterID

Inner Join t_Organization t4 on v1.FSupplyID=t4.FItemID

left outer join t_SubMessage t7 on v1.FSaleStyle=t7.FInterID

Inner Join t_Stock t8 on u1.FDCStockID=t8.FItemID

left outer join t_Emp t9 on v1.FFManagerID=t9.FItemID

left outer join t_Emp t10 on v1.FSManagerID=t10.FItemID

Inner Join t_User t11 on v1.FBillerID=t11.FUserID

Inner Join t_ICItem t14 on u1.FItemID=t14.FItemID

Inner Join t_MeasureUnit t17 on u1.FUnitID=t17.FItemID

left outer join t_User t24 on v1.Fcheckerid=t24.FUserID

Inner Join t_MeasureUnit t30 on t14.FUnitID=t30.FItemID

left outer join t_SubMessage t40 on v1.FMarketingStyle=t40.FInterID

left outer join v_ICTransType t70 on u1.FSourceTranType=t70.FID

left outer join ICVoucherTpl t16 on v1.FPlanVchTplID=t16.FInterID

left outer join ICVoucherTpl t13 on v1.FActualVchTplID=t13.FInterID

left outer join t_Department t105 on v1.FDeptID=t105.FItemID

left outer join t_Emp t106 on v1.FEmpID=t106.FItemID

left outer join t_Emp t107 on v1.FManagerID=t107.FItemID

left outer join t_AuxItem t112 on u1.FAuxPropID=t112.FItemid

left outer join t_MeasureUnit t500 on t14.FStoreUnitID=t500.FItemID

left outer join t_Currency t503 on v1.FCurrencyID=t503.FCurrencyID

left outer join t_StockPlace t510 on u1.FDCSPID=t510.FSPID

left outer join ZPStockBill t523 on v1.FInterID=t523.FRelateBillInterID

left outer join t_SonCompany t550 on v1.FRelateBrID=t550.FItemID

left outer join t_MeasureUnit t552 on t14.FSecUnitID=t552.FItemID

left outer join t_SonCompany t560 on v1.FBrID=t560.FItemID

left outer join rtl_vip t650 on v1.FVIPCardId=t650.Fid

left outer join Rtl_WorkShift t651 on v1.FWorkShiftID=t651.FID

left outer join t_BaseBondedManageType t621 on v1.FManageType=t621.FID

Inner Join t_SubMessage t123 on u1.FPlanMode=t123.FInterID

left outer join CRM_ServiceRequest t800 on v1.FInterID=t800.FSourceInterID

left outer join t_Organization t44 on v1.FConsignee=t44.FItemID

left outer join t_SubMessage tVMI on u1.FIsVMI=tVMI.FInterID

left outer join t_Supplier tSup on u1.FEntrySupply=tSup.FItemID

left outer join t_SubMessage tq224 on u1.FChkPassItem=tq224.FInterID

left outer join t_User tcf on v1.FConfirmer=tcf.FUserID

left outer join t_PayColCondition t_Pay on v1.FPayCondition=t_Pay.FID

left outer join t_Item t3416 on u1.FEntrySelfB0178=t3416.FItemID

WHERE 1=1 AND v1.FTranType=21 AND v1.FTranType=21 AND ((v1.FDate>='2014-07-01' AND v1.FDate<'2014-08-01')) Group By v1.Fdate WITH ROLLUP

update #CrossTab set Fauxqty281=Fauxqty1+Fauxqty2+Fauxqty3

select Case Fdate_Grouping When 1 Then '合計' When 2 Then '小計' ELSE Convert(nVarchar,Fdate_NOGrouping) End As Fdate,* from #CrossTab where FSumSort<> 102 order by column_name

其中兩個華潤是我舉例子用的客戶名字,你自己實際情況自己加,然后我行是客戶,列是日期,這個問題應該不大,如果你一樣要行是日期的話,自己改吧~

對了,我用的是12.3版本