- 浏览: 7871 次
- 性别:
- 来自: 河南
最新评论
文章列表
SELECT
CASE
WHEN LENGTH(R.CUSTOMER_NAME)>9 THEN 'ABC'
ELSE TO_CHAR(R.CUSTOMER_NAME)
END FROM REDEMPTION R
select sum(p.point) as sum_balan,p.customer
from point_transaction p ,customer c
where p.customer=c.id
group by p.customer
聚合函数 使用group by时候,前面出现的字段,group by 时一定要出现
select
--手机显示前八位,后几位以*显示
substr(c.mobile,1,8)||'***' as mobile,
--通讯地址(后五码以*****显示)
c.province||c.city||substr(c.address,length(c.address)-5+1,5)||'*****' as addr
from customer c
select
--姓名(姓名大于四个字的以‘ABC’代替)
case
when length(c.last_name)>5 then 'ABC'
else last_name
end
as moudle
from table1
case
when m.type=1 then 'A'
when m.type=2 then 'B'
when m.type=3 then 'C'
else ' ...
SELECT
CASE
WHEN LENGTH(R.CUSTOMER_NAME)>9 THEN '潮宏基'
ELSE TO_CHAR(CUSTOMER_NAME)
END FROM REDEMPTION R
select to_char(apply_date,'yyyy')||'年' ||to_char(apply_date,'mm')||'月'||to_char(apply_date,'dd')||'日'from redemption;