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 7552059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:39:49+00:00 2026-05-30T10:39:49+00:00

Query Select 9/5 ‘Showing output as 1 I want to get the exact ouput

  • 0

Query

Select 9/5 ‘Showing output as 1

I want to get the exact ouput for 9/5

Expected Ouput

1.8 instead of 1

How to make a query

  • 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-05-30T10:39:50+00:00Added an answer on May 30, 2026 at 10:39 am

    The problem is it is doing integer math. You can explicitly treat them as decimal numbers by adding .0:

    SELECT 9.0 / 5.0
    

    You can also use CONVERT or CAST to be even more explicit:

    SELECT CONVERT(DECIMAL(9,4), 9) / CONVERT(DECIMAL(9,4), 5)
    

    Note: If either of the operands are decimal numbers, the result will be a decimal number, so you technically only have to convert one of them. So any of these will also work:

    SELECT 9 / 5.0
    SELECT 9.0 / 5
    SELECT CONVERT(DECIMAL(9,4), 9) / 5
    SELECT 9 / CONVERT(DECIMAL(9,4), 5)
    

    The reason it works this was is because the ANSI/ISO-SQL standard actually says that the results of mathematical operations must be the same data type as one of the operands. So if both of the operands are integers, the result according to the ANSI/ISO-SQL standard must also be an integer.

    MySQL violates the standard here (presumably in the interest of practicality), but MS SQL complies with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Query: SELECT * FROM Post ORDER BY Post.rating <-- Here , i want (
Query: SELECT SUM(ProductCost) FROM `tblBasket` GROUP BY ProductCode HAVING BasketSessionID = '3429782d79c68834ea698bb4116eef5e' Showing Error
Query: SELECT u.user_id,r.totalVotes votes,r.totalPoints rating,@row:=@row+1 rank FROM mismatch_user u LEFT JOIN ratingItems r ON
Query: SELECT DISTINCT ([Equipment List].ID) AS Expr1, [Job Assignments].Job FROM [Equipment List] LEFT JOIN
my query: select SUM(payments.paid_amt) as paid_amt, SUM(payments.copay_amt) as copay_amt, SUM(payments.CO_INSURANCE_AMT) as co_ins_amt, SUM(payments.PATIENT_RESP_AMT) as
My Query SELECT DATE, SEC_TO_TIME( SUM( TIME_TO_SEC( `total_hours` ) ) ) AS total FROM
this query SELECT * FROM tblContracts LEFT JOIN tblPartys ON tblContracts.id = tblPartys.Contract_id INNER
SQL query: SELECT ArticleCategories.Title AS Category, Articles.Title, Articles.[Content], Articles.Date FROM ArticleCategories INNER JOIN Articles
Why query: SELECT id, MAX(probe_time) AS Expr1 FROM app_states GROUP BY logon_id and SELECT
this is the mysql query SELECT * FROM users AS up JOIN users AS

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.