摘要:
原始数据如下图所示:(商品的销售明细)date=业务日期;Item=商品名称;saleqty=销售数量;-- 建立测试数据(表)create table test (Date varchar(10), item char(10),saleqty int)insert test values('2010-01-01','AAA',8)insert test values('2010-01-02','AAA',4)insert test values('2010-01-03','AAA',5)inser 阅读全文
摘要:
原始数据:select t1.CarModelPKID,t2.DefeatReason, count(*) as count from RT_CustAllocResult tleft join vm_carinfo t1 on t1.FrameNo = t.FrameNoleft join RT_CustFollowUp t2 on t2.RegNo = t.RegNowhere t1.CarModelPKID is not null and t2.DefeatReason is not null group by t2.DefeatReason,CarModelPKID转置后的数据:sel 阅读全文
摘要:
SELECT T1.CARMODELPKID,COUNT(1) FROM RT_CUSTALLOCRESULT TLEFT JOIN VM_CARINFO T1 ON T1.FRAMENO = T.FRAMENOLEFT JOIN RT_CUSTFOLLOWUP T2 ON T2.REGNO = T.REGNOWHERE T1.CARMODELPKID IS NOT NULL AND T2.DEFEATREASON IS NOT NULL GROUP BY CARMODELPKID 阅读全文