sql

insert into HelpClass
( ClassID,ClassName,ParrentClassID,RootID,ClassOrder,ClassState)
(select (select IsNUll(max(classid),0)+1 as b from helpclass),'66',0,0,0,1)






SELECT Province as Province,City as City,ZoneCode,count(*) Total FROM dbo.PV_CallBackLog_20070619 LEFT OUTER JOIN dbo.S_PhoneArea on dbo.ResetNum(CallingNumber) = Number   group by dbo.S_PhoneArea.Province,dbo.S_PhoneArea.City,ZoneCode


SELECT Province as Province,City as City,ZoneCode,count(*) Total
FROM dbo.call_bill_400 LEFT OUTER JOIN dbo.S_PhoneArea on dbo.ResetNum(Caller) = Number 
where SynDate between '2007-06-21' and '2007-06-22'
group by dbo.S_PhoneArea.Province,dbo.S_PhoneArea.City,ZoneCode

你可能感兴趣的:(sql)