0

我需要从数据集中删除小数点后有数字的观察值。一些数字混入了不应该出现的日期集中,除了小数点后有一个数字外,我们没有什么可以告诉它们的,例如:9.42

与实际数据相比,只有 9.0、10.0、100.0。

有没有办法在 SQL 中做到这一点?

4

1 回答 1

1

像这样的东西适用于大多数数据库:

delete from table
    where number <> cast(number as int);

或者,如果 "number" 真的是一个字符串:

delete from table
    where number like '%.%' and number not like '%.0';
于 2014-10-22T14:22:26.113 回答