Hi,
This is My storedprocedure :
GO
ALTER PROCEDURE [dbo].[uspGetVote](@TeamID INT,@CardID INT)
AS
BEGIN
SELECT AVG(VoteValue) AS [AverageVoteValue] FROM Vote
WHERE TeamID=@TeamID and CardID=@CardID and LastModifiedDateTime between getDate()-7 and getDate()
end
ALTER PROCEDURE [dbo].[uspGetVote](@TeamID INT,@CardID INT)
AS
BEGIN
SELECT AVG(VoteValue) AS [AverageVoteValue] FROM Vote
WHERE TeamID=@TeamID and CardID=@CardID and LastModifiedDateTime between getDate()-7 and getDate()
end
When execute this procedure returns Null.
This is my table values :
When i pass TeamID and CardID 1,1 its shows a Null.
Please give a correct query for that.
Thank You.


Raja TRank #685 · 3.5K reputationPosted Sep 3, 2015, 10:01 PM EDT
WHERE TeamID=1 and CardID=1 and LastModifiedDateTime between getDate()-7 and getDate()
WHERE TeamID=1 and CardID=1 and DATEDIFF(DAY,[LastModifiedDateTime],GETDATE()) <= 7
ALTER PROCEDURE [dbo].[uspGetVote](@TeamID INT,@CardID INT)
AS
BEGIN
SELECT AVG(VoteValue) AS [AverageVoteValue] FROM Vote
WHERE TeamID=1 and CardID=1 and DATEDIFF(DAY,[LastModifiedDateTime],GETDATE()) <= 7
end
Rojalin SahooRank #2,919 · 493 reputationPosted Sep 3, 2015, 10:21 PM EDT
Sujeet SumanRank #790 · 2.9K reputationPosted Sep 3, 2015, 10:35 PM EDT
WHERE TeamID=@TeamID and CardID=@CardID and LastModifiedDateTime between getDate()-7 and getDate()
WHERE TeamID=@TeamID and CardID=@CardID and LastModifiedDateTime between getDate()-7 and getDate()