📜  postgress if - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:29.734000             🧑  作者: Mango

代码示例1
-- use postgress case

SELECT name, continent, indep_year,
    CASE WHEN indep_year < 1900 THEN 'before 1900'
         WHEN indep_year <= 1930 THEN 'between 1900 and 1930'
         ELSE 'after 1930' END
         AS indep_year_group
FROM countries
ORDER BY indep_year_group;