Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:44:10+00:00 2026-06-05T22:44:10+00:00

I have this table structure on a SQL Server 2008 R2 database: CREATE TABLE

  • 0

I have this table structure on a SQL Server 2008 R2 database:

  CREATE TABLE FormTest
(   
clientid char(10),
DateSelected date,
A int,
B int,
C int
)

I filled the table FormTest with the following information

clientid        DateSelected      A       B     C
x1              2006-06-09     65150    4921    1
x2              2006-05-05     155926   69092   1
x3              2006-01-20     95603    156892  1
x4              2006-01-20     30704    164741  1
x4              2006-02-03     65150    174834  1
x5              2006-04-28     59629    4921    1
x6              2006-01-27     30704    162356  1
x7              2006-06-30     65150    4921    1
x8              2006-07-10     65150    4921    1

And finally, I run this sql query:

SELECT clientid, (((a+ b + c) / 3) / 216647 * 10) AS Formula1 
    From FormTest

But then I got these results:

clientid        Formula1      
x1              0
x2              0
x3              0
x4              0
x4              0
x5              0
x6              0
x7              0
x8              0

Can anybody tell me what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:44:11+00:00Added an answer on June 5, 2026 at 10:44 pm

    It’s because you are doing integer division. You should convert one of the operands to float, or decimal (depending on the precision and purpose of the calculation you are doing), using something like:

    ((CAST((a+ b + c) AS FLOAT) / 3) / 216647 * 10)
    

    or possibly:

    (((a+ b + c) / 3.0) / 216647.0 * 10)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using SQL Server 2008. I have a database table that looks like this
In our inventory database (SQL Server 2008 std edition) we have a table (called
I have SQL Server 2008 database with two tables. The first table is called
I have a table in a database on my development(local workstation) SQL Server 2008
I have a SQL Server table with the following structure: CREATE TABLE [dbo].[Log]( [LogID]
I have created a table on an Oracle 10g database with this structure :
I use SQL Server 2008, C#, I have a table which contains about 20000
I need your help :) I have a table in a database (SQL Server
My table structure (in SQL Server) looks something like this: (D1 is more recent
I have an existing SQL Server database whose structure I can't really change, although

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.