SQL中的CASE WHEN用法(10)
来源:未知 责任编辑:责任编辑 发表时间:2014-02-02 17:50 点击:次
<BR> from temp
<BR> group by temp.username,temp.action) as T
<BR>
<BR>group by T.username
<BR>
<BR>
<BR>
<BR><BR>
对应的 Oracle 语句:
select username,
<BR> max(decode(action,'CALL',NN,0)) AS CALL_TIMES ,
<BR> max(decode(action,'VIDEO',NN,0)) AS VIDEO_TIMES ,
<BR> max(decode(action,'SEARCH',NN,0)) AS VIDEO_TIMES
<BR>from
<BR> (select username,action,count(*) AS NN from table1
<BR> group by username,action)
<BR>
<BR>group by username
<BR>
作者 dchengquan53390
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>