컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
결과 정렬
다음과 같은 쉼표로 구분된 하나 이상의 시퀀스로 구성된 ORDER BY
절을 사용하여 응답의 행 순서를 지정할 수 있습니다.
FieldName ('ASC' | 'DESC')?
필드 이름 뒤에 ASC
또는 DESC
를 지정하지 않으면 Google Ads API는 기본적으로 ASC
를 사용합니다.
다음 ORDER BY
절은 캠페인 수준 보고서를 노출수 내림차순 및 캠페인 이름 오름차순으로 정렬합니다.
ORDER BY metrics.impressions DESC, campaign.name ASC
다음은 정렬이 허용되지 않습니다.
- 선택되지 않은 리소스의 속성별
- 선택되지 않은 측정항목
- 선택되지 않은 세그먼트
- 다음 유형의 필드의 경우:
결과 수 제한
LIMIT
절을 사용하여 반환되는 총 결과 수를 제한할 수 있습니다.
이 기능을 결과 정렬과 결합하면 지난 30일 동안 노출수가 가장 많은 캠페인 5개를 포함하는 보고서와 같은 '상위 N' 보고서를 생성할 수 있습니다.
SELECT
campaign.id,
campaign.name,
metrics.impressions
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
ORDER BY metrics.impressions DESC
LIMIT 5
필터링은 허용되지 않습니다.
- '핵심' 날짜 세그먼트 필드를 제외하고 세그먼트를 선택하지 않은 경우
- 핵심 날짜 세그먼트 필드는
segments.date
, segments.week
, segments.month
, segments.quarter
, segments.year
입니다.
- 기본 유형을 제외한 모든 메시지 유형의 필드 (예: Int64Value, StringValue 등)
- 기본 유형을 제외한 모든 메시지 유형의 반복되는 필드의 속성 (예:
Int64Value, StringValue 등)
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-09-05(UTC)
[null,null,["최종 업데이트: 2025-09-05(UTC)"],[[["\u003cp\u003eYou can control the order of results using the \u003ccode\u003eORDER BY\u003c/code\u003e clause, specifying fields and sort direction (ASC or DESC).\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eLIMIT\u003c/code\u003e clause lets you restrict the number of returned results, enabling "top N" reports when combined with \u003ccode\u003eORDER BY\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eOrdering is disallowed by attributes of non-selected resources, by non-selected metrics or segments, and for fields of type \u003ccode\u003eMESSAGE\u003c/code\u003e, repeated fields, or attributes of repeated fields.\u003c/p\u003e\n"],["\u003cp\u003eFiltering is restricted for segments without selection (excluding core date segments), fields of non-primitive message types, and attributes of repeated fields with non-primitive message types.\u003c/p\u003e\n"]]],[],null,["Order results\n-------------\n\nYou can specify the order of rows in your response using the `ORDER BY` clause,\nwhich consists of one or more comma-separated sequences of: \n\n FieldName ('ASC' | 'DESC')?\n\nIf you don't specify `ASC` or `DESC` after a field name, the Google Ads API defaults to\n`ASC`.\n\nThe following `ORDER BY` clause sorts a campaign-level report by descending\nimpressions and ascending campaign name: \n\n ORDER BY metrics.impressions DESC, campaign.name ASC\n\nOrdering is not allowed:\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n- By attributes of non-selected resources\n- By non-selected metrics\n- By non-selected segments\n- For fields of the following types:\n - `MESSAGE`\n - Repeated fields\n - Attributes of repeated fields\n\nLimit the number of results\n---------------------------\n\nYou can limit the total number of results returned using the `LIMIT` clause.\nCombining this with results ordering, you can produce \"top N\" reports,\nsuch as a report containing the five campaigns with the highest impressions\nover the last 30 days: \n\n SELECT\n campaign.id,\n campaign.name,\n metrics.impressions\n FROM campaign\n WHERE segments.date DURING LAST_30_DAYS\n ORDER BY metrics.impressions DESC\n LIMIT 5\n\nFiltering is not allowed:\n\n- On segments without selecting them, except for \"core\" date segment fields.\n - The core date segment fields are `segments.date`, `segments.week`, `segments.month`, `segments.quarter`, and `segments.year`.\n- On fields of any message type except primitives (e.g.: Int64Value, StringValue, etc.)\n- On attributes of repeated fields of any message type except primitives (e.g.: Int64Value, StringValue, etc.)"]]