zoukankan      html  css  js  c++  java
  • oracle decode 函数

    DECODE 

    语法: 

    SELECT DECODE( <EXPR,SEARCH1,RESULT1,SEARCH2,RESULT2,...[,DEFAULT]>)
    FROM <TABLE_NAME>
    

    e.g.:

    select orderno,decode(ostatus,'p','准备处理','c','已完成') 

    from order_master

    此函数可用于行转列:

    select * from score

    SELECT   u_id, stu_name, 
             SUM (DECODE (score_type, '语文', score, 0)) AS 语文, /*or use max()*/
             SUM (DECODE (score_type, '数学', score, 0)) AS 数学,
             SUM (DECODE (score_type, '外语', score, 0)) AS 外语
        FROM score
    --where u_id>1
    GROUP BY u_id, stu_name
    --having u_id >1
    ORDER BY u_id
    

  • 相关阅读:
    Ajax请求参数解释
    下拉菜单:‘点击外面关闭’的解决方案
    nc
    telnet
    arping
    traceroute
    ping
    ss
    netstat
    ip
  • 原文地址:https://www.cnblogs.com/wucg/p/2102218.html
Copyright © 2011-2022 走看看