pl/sql问题。(70分)

  • 主题发起人 主题发起人 kk520
  • 开始时间 开始时间
K

kk520

Unregistered / Unconfirmed
GUEST, unregistred user!
我有几个客户,若每一年订货量在60万以下的,列为D等级,60万到70万的,列为C,70万-1200万的,列为B,之上的,列为A,用SQL如何实现.
 
select 客户名称,DECODE(case when 订货量&lt;60万 then 'd'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when 订货量&gt;60 and 订货量&lt;70 then 'C'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when 订货量&gt;70 and 订货量&lt;1200 then 'B'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when 订货量&gt;1200 then 'A')<br>&nbsp; &nbsp;FROM 表名
 
用Case When...Then... <br>Case When dhl &lt;= 60 Then 'D'<br>&nbsp; When (dhl &gt; 60 and dhl &lt;= 70) Then 'C'<br>&nbsp; When (dhl &gt; 70 and dhl &lt;= 1200) Then 'B'<br>Else 'A' End dj
 
多人接受答案了。
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部