求一升降级别语句

[复制链接]
查看11 | 回复2 | 2006-9-7 17:01:08 | 显示全部楼层 |阅读模式
表:unitstore
字段:SID --客户编号如: A10003

amount --金额如:2300.00

blevel---调整前等级 等级 分为:C,E,L,M一级比一级高

slevel---调整后等级 如:L

count---- 店数如: 1,2,3

cdate---- 开店时间 20060904




要求: 升级:升为“M” 条件为: amount>180000 并且 count>=3并且blevel='L'

升为 “L” 条件为: amount>120000 并且 count>=2 并且blevel='E'

升为“E” 条件为: amount>60000

降级: 降为"L" 条件为: blevel='M' 并且(amount180000 and count>=3 and blevel='L' then

'M'

when amount>120000 and count>=2 and blevel='E' then

'L'

when blevel='C' and amount>60000 then

'E'

when blevel='M' and (amount to_date('20070111', 'YYYY-MM-DD') then

slevel
end slevel,
cdate
from unitstore;

回复

使用道具 举报

千问 | 2006-9-7 17:01:08 | 显示全部楼层
bell6248总是很热心啊
回复

使用道具 举报

千问 | 2006-9-7 17:01:08 | 显示全部楼层
楼上的都很热心啊,
to bell6248: 这个sql好像有点问题啊,得不到我想要的结果
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行