SELECT
id, IF(report.type = 'P', abs(amount), -1*abs(amount)) as amount
FROM report
SELECT
id
, IF(type = 'P', IFNULL(amount,0), IFNULL(amount,0) * -1) as amount
FROM report
mysql-isnull
mysql-ifnull
mysql-if-null
MYSQL-NULL
e.g.
select
if(isnull(NameOfOverseaCo),'',NameOfOverseaCo),
if(isnull(AddrOfOverseaCo),'',AddrOfOverseaCo)
from tableName;
沒有留言:
張貼留言