Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I've got this

 

SELECT id, memberID, ((Q + V + C + R + T) / 5) AS TotalScore

FROM dbo.csd_MemberFeedbacks

 

The 5 values are integers in the database.

 

The statement runs fine but TotalScore is always returned as a whole number.

 

For example if the values in the DB are 3,4,5,4,3 then I want 3.8 to be returned, but I get 4.

 

How can I fix it so TotalScore in a decimal.

 

Thanks

Posted

Convert(...)

 

Try the CONVERT function:

 

SELECT id, memberID,
  (CONVERT(real, Q + V + C + R + T) / 5.0)
AS TotalScore
FROM dbo.csd_MemberFeedbacks

 

Good luck :cool:

Never trouble another for what you can do for yourself.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...