MySQL数据库 有个列 值为
1.4
1.5
3.2
3.2
3.3
3.8
4.9
5.1
5.1
6
怎么才能取到
1,3,4,5,6
SELECT FLOOR(name) FROM aa
name为字段 aa为表
xx为字段名
SELECT DISTINCT(FLOOR(xx))FROM tablename
你是想取是整数的数据,还是想取数据的整数部位呀?如果是前者,用正则REGEXP '^-?[0-9]+$';如果是后者,那么用floor就可以了
1、select * from 表名 where 字段 REGEXP '^-?[0-9]+$';
2、select floor(字段) from 表名
select * from test where id in (1,3,4,5,6)
看这个,这里面的应该是你要的:https://www.itranslater.com/qa/details/2583247524471505920
select STUFF((select ','+ SUBSTRING(CODE,0,charindex('.',CODE,1)) from [dbo].[Test1] group by SUBSTRING(CODE,0,charindex('.',CODE,1)) for xml path('')),1,0,'')