---
title: "\uCCAB \uBC88\uC9F8 \uC9D1\uACC4 \uD568\uC218"
description: "\uC815\uB82C\uB41C \uACB0\uACFC \uC9D1\uD569\uC5D0\uC11C \uCCAB \uBC88\uC9F8 null\uC774 \uC544\uB2CC \uAC12\uC744 \uCC3E\uB294 \uADF8\uB8F9 \uD568\uC218\uC785\uB2C8\uB2E4."
language: ko
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/ko/docs/invantive-universalsql/grammar/aggregate-functions/first-aggregate-function
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/aggregate-functions/first-aggregate-function
updated: 2026-12-04T12:45:54Z
license: https://documentation.invantive.eu/ko/
---

## 구문

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    firstAggregateFunction_start((START))
    firstAggregateFunction_start --> firstAggregateFunction_0_0[FIRST]:::quoted
    firstAggregateFunction_0_0 --> firstAggregateFunction_0_1["("]:::quoted
    firstAggregateFunction_0_1 --> firstAggregateFunction_0_2[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    firstAggregateFunction_0_2 --> firstAggregateFunction_0_3[")"]:::quoted
    firstAggregateFunction_0_3 --> firstAggregateFunction_end((END))
```

## 목적

정렬된 결과 집합에서 첫 번째 non-`null` 값을 찾는 그룹 함수입니다. 행의 순서는 소스에 의해 결정됩니다. 결정적인 결과를 얻으려면 중첩 쿼리에서 `order by`와 함께 사용하십시오.

## 예시
다음 예제는 연락처가 저장된 순서대로 연락처 목록에서 첫 번째 담당자를 가져옵니다:
```sql
select first(cnt.contact_name)
from   csvtable
       ( passing 'Acme Industries#Alice Johnson#CFO|Acme Industries#Tom Peters#Accounts Payable|Bergmann GmbH#Erika Weber#Controller|Carlson Ltd#James Smith#CFO|Dubois SA#Marie Dupont#Accounts Payable'
         row delimiter '|'
         column delimiter '#'
         columns customer_name varchar2 position next
         ,       contact_name  varchar2 position next
         ,       role          varchar2 position next
       ) cnt

-------------------
Alice Johnson
```
다음 예제는 고객별로 알파벳순에서 첫 번째 담당자를 가져옵니다. 예를 들어 독촉장의 기본 수신자로 사용할 수 있습니다:
```sql
select srt.customer_name
,      first(srt.contact_name)
from   ( select cnt.customer_name
         ,      cnt.contact_name
         from   csvtable
                ( passing 'Acme Industries#Alice Johnson#CFO|Acme Industries#Tom Peters#Accounts Payable|Bergmann GmbH#Erika Weber#Controller|Carlson Ltd#James Smith#CFO|Dubois SA#Marie Dupont#Accounts Payable'
                  row delimiter '|'
                  column delimiter '#'
                  columns customer_name varchar2 position next
                  ,       contact_name  varchar2 position next
                  ,       role          varchar2 position next
                ) cnt
         order
         by     cnt.customer_name
         ,      cnt.contact_name
       ) srt
group
by     srt.customer_name
order
by     srt.customer_name

-------------------
Acme Industries    Alice Johnson
Bergmann GmbH      Erika Weber
Carlson Ltd        James Smith
Dubois SA          Marie Dupont
```

