常见问题解答
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页收集了一些有助于您创建首个查询的提示。
问题:指标未显示在结果中
与货币相关的指标(例如 metrics.cost_micros)需要在 SELECT 子句和 WHERE 子句中添加 segments.date
。
问题:CONTAINS 运算符不适用于字符串字段
当您需要检查字符串字段是否包含子字符串时,请勿使用 CONTAINS
(或 CONTAINS NOT
)运算符。
CONTAINS
适用于存储值列表且您想要检查该列表是否包含一个或多个特定值的字段。
如需检查是否存在子字符串,您可以使用 REGEXP_MATCH
,例如
SELECT
customer.descriptive_name,
... // other fields
FROM
campaign
WHERE customer.descriptive_name REGEXEP_MATCH 'Customer.*'
了解详情
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eCurrency metrics like \u003ccode\u003emetrics.cost_micros\u003c/code\u003e require including \u003ccode\u003esegments.date\u003c/code\u003e in both the SELECT and WHERE clauses to appear in results.\u003c/p\u003e\n"],["\u003cp\u003eAvoid using the \u003ccode\u003eCONTAINS\u003c/code\u003e operator for substring checks in string fields; utilize \u003ccode\u003eREGEX_MATCH\u003c/code\u003e instead for this purpose.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCONTAINS\u003c/code\u003e operator is designed for verifying if a list-type field contains specific values.\u003c/p\u003e\n"]]],["Currency metrics like `metrics.cost_micros` require `segments.date` in both the SELECT and WHERE clauses. The `CONTAINS` operator is not for substring searches within string fields; it's for checking value lists. Use `REGEXP_MATCH` to find substrings in string fields, as demonstrated with the example of searching `customer.descriptive_name` for patterns like 'Customer.*'.\n"],null,["# FAQ\n\nThis page collects some tips that could be useful when creating your first\nqueries.\n\nProblem: A metric does not appear in results\n--------------------------------------------\n\nCurrency related metrics (e.g. metrics.cost_micros) need to include\n`segments.date` in the SELECT clause and in the WHERE clause.\n\nProblem: CONTAINS operator does not work with a string field\n------------------------------------------------------------\n\nWhen you need to check if a string field contains a substring, don't use the\n`CONTAINS` (or `CONTAINS NOT`) operator.\n\n`CONTAINS` is meant to be used with fields that keep lists of values and you\nwant to check if the list contains one or more specific values.\n\nTo check the presence of a substring you can use `REGEXP_MATCH`, for example \n\n SELECT\n customer.descriptive_name,\n ... // other fields\n FROM\n campaign\n WHERE customer.descriptive_name REGEXEP_MATCH 'Customer.*'\n\nLearn more\n----------\n\n- [Sample queries](/search-ads/reporting/query/sample-queries)"]]