[英]Select only numeric value
I have a table structure like below. 我有一个像下面这样的表结构。
id version REQ_REF_ID
3 1.2 6
2 1.1 6
1 1 6
My query is below 我的查询如下
Select * from XYZ where REQ_REF_ID = 6606 order by version desc FETCH FIRST 2 ROWS ONLY
It gives me the latest 2 rows which id is 3 and 2. 它给了我最新的2行,id为3和2。
But I want to get only those two row where version
number is integer, not having decimal values. 但是我只想获取
version
号是整数而不是十进制值的那两行。
In this case I want to get the row which id is 1. 在这种情况下,我想获取id为1的行。
您也可以使用TRANSLATE
where translate(VERSION, '?1234567890', '?') is null
you can check like 你可以检查像
and (version)%1 = 0
% by 1 will give you decimal parts if any %by 1将为您提供小数部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.