222
Глава 11. Условная логика
mysql>
SELECT
>
SUM(CASE
>
WHEN EXTRACT(YEAR FROM open_date) = 2000 THEN 1
>
ELSE 0
>
END) year_2000,
>
SUM(CASE
>
WHEN EXTRACT(YEAR FROM open_date) = 2001 THEN 1
>
ELSE 0
>
>
SUM(CASE
>
WHEN EXTRACT(YEAR FROM open_date) = 2002 THEN 1
>
ELSE 0
>
END) year_2002,
>
SUM(CASE
>
WHEN EXTRACT(YEAR FROM open_date) = 2003 THEN 1
>
Достарыңызбен бөлісу: