您的位置:首页 > 数据库 > Oracle

Oracle sql 去除重复 和 字段去除空格

2016-07-21 16:32 525 查看
1.去除重复两种方式 

1.1 distinct 函数

select distinct userid from projectinfo where projecttype in (select id from p_fundcategory where departid = 21 and parentid !=0)

1.2  group by 也可以

select userid,count(userid) from projectinfo where projecttype in (select id from p_fundcategory where departid = 21 and parentid !=0) group by userid

2.去除左右空格
函数 ltrim左边空格

函数rtrim右边空格

两个函数联合使用 ltrim(rtrim(name))
就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: