22,210
社区成员
发帖
与我相关
我的任务
分享
--设置默认值
ALTER proc proc_bosChangeItem(
@beginDate datetime=0,
@endDate datetime='9999-12-31'
)
as
set nocount on
select IDENTITY(int,1,1) AS 名次, c.fname as 部门,sum(a.famount) as 换货金额 ,sum(a.fqty) 换货数量 into #temp from t_boschangeitementry a
left join t_boschangeitem b on a.fid=b.fid
left join t_department c on b.fdeptid=c.fitemid
where b.fchecker>0 and b.fdate between @beginDate and @endDate
group by c.fname
order by 换货金额 desc
select * from #temp
drop table #temp
ALTER proc proc_bosChangeItem(
@beginDate datetime='1900-01-01',
@endDate datetime =getdate()
)
as
set nocount on
select IDENTITY(int,1,1) AS 名次, c.fname as 部门,sum(a.famount) as 换货金额 ,sum(a.fqty) 换货数量 into #temp from t_boschangeitementry a
left join t_boschangeitem b on a.fid=b.fid
left join t_department c on b.fdeptid=c.fitemid
where b.fchecker>0 and b.fdate between @beginDate and @endDate
group by c.fname
order by 换货金额 desc
select * from #temp
drop table #temp
GO
设置默认值