📜  选择 if then postgresql 代码示例

📅  最后修改于: 2022-03-11 15:05:31.759000             🧑  作者: Mango

代码示例1
SELECT field1, field2,
  CASE
    WHEN field1>0 THEN field2/field1
    ELSE 0
  END 
  AS field3
FROM test