SELECT ANIMAL_TYPE, COUNT(ANIMAL_TYPE) AS "count"
FROM ANIMAL_INS
WHERE ANIMAL_TYPE IN ('Cat', 'Dog')
GROUP BY ANIMAL_TYPE
ORDER BY FIELD(ANIMAL_TYPE, 'Cat', 'Dog');
SELECT ANIMAL_TYPE, COUNT(ANIMAL_TYPE) AS "count"
FROM ANIMAL_INS
WHERE ANIMAL_TYPE IN ('Cat', 'Dog')
GROUP BY ANIMAL_TYPE
ORDER BY
CASE ANIMAL_TYPE
WHEN 'Cat' THEN 1
WHEN 'Dog' THEN 2
END;
'ㅋㅌ' 카테고리의 다른 글
LEFT, GROUP BY (0) | 2023.09.10 |
---|---|
[SQL] GROUP BY (1) | 2023.09.08 |
[SQL] DATE_FORMAT (0) | 2023.09.06 |
[SQL] EXTRACT(YEAR FROM ***) (0) | 2023.09.05 |
[SQL] DISTINCT (0) | 2023.09.04 |