Yousef Darvesh
Yousef Darvesh

Reputation: 11

How to remove Decimal from SQL select statment

SELECT DISTINCT CAST(MHSE_ AS INT) AS MHSE_ from [EnterpriseGIS].[gisdba].[TAXPARCEL] 

This is my statement but the result comes like

4959.000000

I wanted to show

4959

Upvotes: 0

Views: 53

Answers (1)

John Odom
John Odom

Reputation: 1213

I'm not sure what DBMS you are using but you could try using the FLOOR() function like so:

SELECT DISTINCT FLOOR(MHSE_) AS MHSE_
FROM [EnterpriseGIS].[gisdba].[TAXPARCEL]

Here is the description of the FLOOR function:

The SQL FLOOR() rounded up any positive or negative decimal value down to the next least integer value. SQL DISTINCT along with the SQL FLOOR() function is used to retrieve only unique value after rounded down to the next least integer value depending on the column specified.

Upvotes: 2

Related Questions