집계를 수행하면 더 유용한 경우도 있습니다. 이번에는 각 방향이 언급된 개수를 계산해봅시다
(필드의 타입이 문자열이 아니라 판매량 등의 숫자 타입인 경우에는
sum
함수로 합계를 구하
거나
avg
함수로 평균값을 구할 수도 있습니다).
SELECT
count
(
case
when
description
ilike
‘%south%’
then
1
end
)
as
south
,
count
(
case
when
description
ilike
‘%north%’
then
1
end
)
as
north
,
count ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.