亲爱的 我想要选择sql Query添加 - 签名到invoiceType ='s'的数字 我该怎么办?
答案 0 :(得分:0)
使用案例条件检查invoiceType ='s'然后集中 - 签署否则使用普通invoiceamount。
SELECT CASE WHEN invoiceType ='s' THEN '-'||invoiceamount ELSE invoiceamount END FROM Invoice;
或
SELECT CASE WHEN invoiceType ='s' THEN (invoiceamount * -1) ELSE invoiceamount END FROM Invoice;