34,575
社区成员
发帖
与我相关
我的任务
分享
create proc ['p_getUserGameCountTo10']
(
@award int,
@userId int,
@tid int,
@state int output
)
as
declare @gameCount int
declare @taskID int
declare @taskCount int
begin
set @taskCount = (SELECT count(1) FROM [LFDSDB].[dbo].[taskInfo] where [userId]=@userId)
if @taskCount = 0
begin
INSERT INTO [LFDSDB].[dbo].[taskInfo]([userId],[tid],[state],[addDate])VALUES(@userId,@tid,0,getdate())
end
if @taskCount=1
begin
set @gameCount=select (avg(WinCount)+avg(LostCount)+avg(DrawCount)+avg(FleeCount)) as resultCount from GameScoreInfo where UserID=@userId
if @gameCount>10
@state=2
else
@state=1
end
end
create proc ['p_getUserGameCountTo10']
(
@award int,
@userId int,
@tid int,
@state int output
)
as
declare @gameCount int
declare @taskID int
declare @taskCount int
begin
set @taskCount = (SELECT count(1) FROM [LFDSDB].[dbo].[taskInfo] where [userId]=@userId)
select @taskCount=count(1) from [LFDSDB].[dbo].[taskInfo] where [userId]=@userId
if @taskCount = 0
begin
INSERT INTO [LFDSDB].[dbo].[taskInfo]([userId],[tid],[state],[addDate])VALUES(@userId,@tid,0,getdate())
end
if @taskCount=1
begin
select @gameCount=(avg(WinCount)+avg(LostCount)+avg(DrawCount)+avg(FleeCount)) from GameScoreInfo where UserID=@userId
if @gameCount>10
set @state=2
else
set @state=1
end
end
create proc ['p_getUserGameCountTo10']
(
@award int,
@userId int,
@tid int,
@state int output
)
as
declare @gameCount int
declare @taskID int
declare @taskCount int
begin
set @taskCount = (SELECT count(1) FROM [LFDSDB].[dbo].[taskInfo] where [userId]=@userId)
if @taskCount = 0
begin
INSERT INTO [LFDSDB].[dbo].[taskInfo]([userId],[tid],[state],[addDate])VALUES(@userId,@tid,0,getdate())
end
if @taskCount=1
begin
select @gameCount= (avg(WinCount)+avg(LostCount)+avg(DrawCount)+avg(FleeCount)) from GameScoreInfo where UserID=@userId
if @gameCount>10
set @state=2
else
set @state=1
end
end
create proc ['p_getUserGameCountTo10']
(
@award int,
@userId int,
@tid int,
@state int output
)
as
declare @gameCount int
declare @taskID int
declare @taskCount int
begin
--set @taskCount = (SELECT count(1) FROM [LFDSDB].[dbo].[taskInfo] where [userId]=@userId)
select @taskCount=count(1) from [LFDSDB].[dbo].[taskInfo] where [userId]=@userId
if @taskCount = 0
begin
INSERT INTO [LFDSDB].[dbo].[taskInfo]([userId],[tid],[state],[addDate])VALUES(@userId,@tid,0,getdate())
end
if @taskCount=1
begin
select @gameCount=(avg(WinCount)+avg(LostCount)+avg(DrawCount)+avg(FleeCount)) from GameScoreInfo where UserID=@userId
if @gameCount>10
set @state=2
else
set @state=1
end
end