0

I wanted to to display only the non rounded decimal values using sql access.

I have tried the the query;

select * from table1 where oc_amount!=0; 

But its not returning the value.

enter image description here

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • attached is the image if i use select * from table1 – Joseph Wilson Nov 21 '17 at 04:26
  • Read about using float values vs decimal in sql. The values printed are in general only approximations of the values stored, and values stored default to base 2. PS For the future: Please [use text for text, don't use images/links](https://meta.stackoverflow.com/a/285557/3404097). Also please read & act on [mcve]. Also edit clarifications into posts, not comments. – philipxy Nov 21 '17 at 05:12
  • yes philipxy i will do that in future still new to this.thanks – Joseph Wilson Nov 21 '17 at 06:22
  • Hi. Please edit your question using the 'edit' link. When I suggested that duplicate I was thinking you were comparing to a non-zero value. But zero ought to work. (Maybe your column is a string?) So it's not clear what your problem is. So give a [mcve]. Eg "tried the query" & "its not returning the value" tell us nothing--give actual executable input, DDL, DML, output, expected output, etc. – philipxy Nov 21 '17 at 11:20

1 Answers1

0

You would need to compare the raw value to the rounded value

select * from table1 where oc_amount <> Round(oc_amount, 0)

If that isn't what you really wanted, try:

select * from table1 where (Round(oc_amount, 2) - Round(oc_amount, 0)) > 0

(*adjust the number of decimals of rounding to suit your need)

Paul Maxwell
  • 33,002
  • 3
  • 32
  • 51
  • when i run this query, it just display all the value including round figure like 0.1000,0.3000 and i cant use != in access instead of this i use <> – Joseph Wilson Nov 21 '17 at 06:23
  • if `!=` does not work why did you include in your question? I used it only because of that. Personally I prefer `<>`, so `<>` it is. The fact that it displays all the values means all values **are not equal** to the rounded value. – Paul Maxwell Nov 21 '17 at 06:27