美文网首页
Oracle case when

Oracle case when

作者: ilaoke | 来源:发表于2016-01-29 11:05 被阅读20次

    CASE WHEN的语法:

    SELECT c.bank_account,
           c.id,
           css.value,
           b.name bankName,
           d.name branceName,
           CASE
             WHEN css.value = '1' THEN d.name
             WHEN css.value = '2' THEN b.name || d.name
             ELSE d.name
           END AS qualifiedBankName
      FROM ff_comp_bank c
      LEFT JOIN ff_bank_branch d ON c.branch_id = d.id
      LEFT JOIN ff_bank b ON b.id = d.bank_id
      LEFT JOIN ff_sys_setting css ON css.name = 'BANK_BRANCH_NAME'
     WHERE c.company_id = '2';
    

    晚上的火车,回家过年了... D4652

    相关文章

      网友评论

          本文标题:Oracle case when

          本文链接:https://www.haomeiwen.com/subject/cayjkttx.html