问一SELECT小问题.
日期:2006-03-12 荐:
问一SELECT小问题.表名:TESTTABLEITEM_NO ITEM_QTYAAA 5BBB -8CCC -10DDD 6当ITEM_QTY<0时候,就显示0,不显示负数。ITEM_NO ITEM_QTYAAA 5BBB 0CCC 0DDD 6要这样的结果,怎样写SELECT?select TTEM_NO,(case when ITEM_QTY<=0 then 0 else ITEM_QTY) as ITEM_QTYfrom TESTTABLE上面的錯了。忘了一個endselect TTEM_NO,(case when ITEM_QTY<=0 then 0 else ITEM_QTY end) as ITEM_QTYfrom TESTTABLEselect item_no,item_qty=case when item_qty<0 then 0 else item_qty endfrom testtablename
标签: