Reputation: 8584
CREATE TABLE `sample` (
`number` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
mysql> select * from sample
+-------------------+
| number |
+-------------------+
| 1 |
| 2 |
| 3.5 |
| 4.5 |
| 0.1 |
+-------------------+
How can I get only the three decimal numbers?
+-------------------+
| number |
+-------------------+
| 3.5 |
| 4.5 |
| 0.1 |
+-------------------+
Upvotes: 0
Views: 910
Reputation: 93754
Here is a another way using %
opertaor
select *
from Youtable
where `number` % 1 <> 0
Upvotes: 1
Reputation: 62861
Here's one option with cast
:
select *
from sample
where cast(number as unsigned) <> number
Upvotes: 2