zoukankan      html  css  js  c++  java
  • select 中的逻辑判断 sql server

    SELECT     CASE field0010 WHEN '计划' THEN 1 ELSE 2 END AS s
    FROM         formmain_5991
    SELECT
           
    CASE WHEN (IFNULL(o.ENDTIME,99))=99
    THEN
    (CASE WHEN (CURDATE()-pc.FORECASTTIME)>0
    THEN
    (CASE WHEN (CURDATE()-pc.FORECASTTIME)>7 THEN 2 ELSE 1 END)
    ELSE
    0
    END)
    ELSE 0
    END AS overtime
    
    FROM  tb_a

    select case
           when 项目名称  IS NULL
           then '空值'
           when 项目名称 ='北二环'
           then 'A'
           when 项目名称 ='北三环'
           then 'B'
           else 'C'
           END  项目名称
    from   物件设计数量统计表
    
    
    SELECT     field0001 AS 项目名称, field0002 AS 项目编号, field0003 AS 计划开始, field0004 AS 计划结束, field0005 AS 节点名称, 
                          CASE field0010 WHEN '计划' THEN field0012 ELSE CASE isnull(field0012, 0) WHEN 0 THEN field0003 WHEN 1 THEN field0012 END END AS 节点开始时间, 
                          CASE field0010 WHEN '计划' THEN field0013 ELSE CASE isnull(field0013, 0) WHEN 0 THEN getdate() WHEN 1 THEN field0013 END END AS 节点结束时间, 
                          CASE field0010 WHEN '计划' THEN field0013 ELSE field0013 END AS 节点里程碑时间, field0006 AS 节点编号, field0010 AS 节点类型
    FROM         formmain_5991
     
  • 相关阅读:
    Less(27a)GET
    Less(27)GET
    虚拟机打开文件黑屏
    mysql开放远程连接权限
    fidder如何设置代理转发
    如何获取APK的包名
    ADB调试原理之通俗版本
    adb端口5037被占用怎么办
    ADB调试原理
    如何使用无线调试手机
  • 原文地址:https://www.cnblogs.com/lionmxs/p/10825531.html
Copyright © 2011-2022 走看看