I have a photo rating system on my site.. one table, RateMe, which contains the votes, who made the vote, and who the vote was for.
In my stored proc, whenever a vote is cast I then do a count of the votes and get a new average to store against the members profile. This is what I'm doing at the moment:
Update Members
Set Votes = (SELECT COunt(RateID)
From RateMe
Where rMemberID = @rMemberID),rating = (SELECT AVG(CAST(rating as decimal(5,4)))
From RateMe
Where rMemberID = @rMemberID)
Where MemberID = @rmemberID
But I can't get the average to come out with decimal points.. ie, 5.67. All i get is 5, or 6, just a single number. Is there something wrong I am missing here?
In my stored proc, whenever a vote is cast I then do a count of the votes and get a new average to store against the members profile. This is what I'm doing at the moment:
Update Members
Set Votes = (SELECT COunt(RateID)
From RateMe
Where rMemberID = @rMemberID),rating = (SELECT AVG(CAST(rating as decimal(5,4)))
From RateMe
Where rMemberID = @rMemberID)
Where MemberID = @rmemberID
But I can't get the average to come out with decimal points.. ie, 5.67. All i get is 5, or 6, just a single number. Is there something wrong I am missing here?