執(zhí)行如下sql:select value from table where id=1查詢出來的值可能大于0也可能小于0。我現(xiàn)在想把小于0的結(jié)果全都改成0輸入。這個(gè)用decode函數(shù)怎么做的?好像是select decode(value...?) from table where id=1select case when value<=0 then 0 else value end from table where id=1那如果在一個(gè)查詢語句中同時(shí)查詢兩個(gè)安段的情況應(yīng)該怎么寫呢?比如:select a,b from table,對b進(jìn)行判斷
想要請教sql decode函數(shù)的一個(gè)簡單用法,具體內(nèi)容如下所示
飲歌長嘯
2022-03-03 11:07:18