https://www.codenong.com/11299037/

SELECT
    CASE
        WHEN stage = 1 THEN 'running'
        WHEN stage = 2 THEN 'done'
        WHEN stage = 3 THEN 'stopped'
    ELSE
        'not running'
    END AS run_status FROM processes

IF SELECT COUNT(*) FROM orders > 0
THEN
  DELETE FROM orders
ELSE
  INSERT INTO orders VALUES (1,2,3);
END IF;

ifnull COALESCE


1、mysql中的ifnull()函数对应postgresql的COALESCE

COALESCE('字段名称','期望值')

2、示例

select
            COALESCE(p.valid,0)  ,p.valid
        from
        b_app_ability_plan p 
—
文档更新时间: 2023-06-17 11:45   作者:admin