The following stored procedure works well as far as it goes but I need help to amend it.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
ALTER PROCEDURE [dbo].[calcDrawAE]
-- Add the parameters for the stored procedure here
@AE decimal (18,2) output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
declare @odds decimal (18,2)
(SELECT @odds= sum
(1/ (RacingMaster.RM_SP) )
FROM RacingMaster
where RM_Draw='1')
declare @totwins decimal (18,2)
(select @totwins =count(*) from RacingMaster
where RM_Draw=1
and Finishing_Position=1)
declare @totRns decimal (18,2)
(select @totRns =count(*) from RacingMaster
where RM_Draw ='1')
set @AE=@totwins/@odds
return @AE
end
The column RM_Draw holds integer values from 1 through to 20. Can someone please provide a way so that when the procedure has produced a result based on RM_Draw='1'' it will produce a separate result for RM_Draw=2 and so all the way to 20 so that the resultant figures can be outputted to my vb.net app.
Many thanks.