dtj88302 2016-06-25 10:25
浏览 118
已采纳

UPDATE查询中的MySql CASE语句

I have a problem in getting the values from Table A and updating to Table B with a CASE Statement. My CASE Statement is as follows. I guess there is an syntax error:

$strSQLInsert2 = "UPDATE commercial_acc_cust SET pbg_curr =  
CASE WHEN ('".$values["main_section"]."'='Bank Guarantee PBG') Then 'pbg_curr' 
END 
WHERE tender_id=" . $values["tender_id"];
  • 写回答

1条回答 默认 最新

  • douxi4287 2016-06-25 10:30
    关注
    if($values["main_section"] == 'Bank Guarantee PBG'){    
        $strSQLInsert2 = "UPDATE commercial_acc_cust SET pbg_curr = 'pbg_curr' 
        WHERE tender_id=" . $values["tender_id"];
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?