數據庫中條件判斷Case的用法

語法: case when 條件 then 值1 else 值2 end 示例: select (case when t.project_id=‘0’ then 1 else ln(t.project_id) end) LN from MES2_BYD_SHOPORDER t 當t.project_id等於0時,返回1,否則返回ln(t.project_id)。這樣可以防止ln()中參數爲0而報錯
相關文章
相關標籤/搜索