You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SQL WHERE子句查询无结果求助:LIKE匹配失效排查

问题分析与解决方案

1. 大小写不匹配

BigQuery的LIKE操作符默认区分大小写,你查询中用的是大写的SEP,但实际数据里是Sep(首字母大写),导致无法匹配。

解决办法:

  • 使用不区分大小写的ILIKE替代LIKE:
SELECT dealname, email, courses
FROM `airbyte-bigquery.hubspot_airbyte.deals_properties`
WHERE closedate > '2022-09-01' AND courses ILIKE "%SEP 2022 - Global Design%"
  • 或者统一转换为小写(或大写)后匹配:
SELECT dealname, email, courses
FROM `airbyte-bigquery.hubspot_airbyte.deals_properties`
WHERE closedate > '2022-09-01' AND LOWER(courses) LIKE LOWER("%SEP 2022 - Global Design%")

2. 关键词冗余

你查询中用的是SEP 2022 - Global Design,但实际数据里的内容是Sep 2022 - Design,多了Global关键词,这也会导致无匹配结果。

解决办法:
调整关键词为实际存在的内容,比如:

SELECT dealname, email, courses
FROM `airbyte-bigquery.hubspot_airbyte.deals_properties`
WHERE closedate > '2022-09-01' AND courses ILIKE "%Sep 2022 - Design%"

3. 额外排查点

  • 先移除closedate条件测试,确认是否是日期过滤掉了目标数据,再逐步验证日期范围是否正确。
  • 检查courses列是否有隐藏字符(如空格、换行):可以用TRIM(courses)去除前后空格后匹配,或用正则进行更灵活的匹配:
SELECT dealname, email, courses
FROM `airbyte-bigquery.hubspot_airbyte.deals_properties`
WHERE closedate > '2022-09-01' AND REGEXP_CONTAINS(courses, r"Sep 2022 - Design", 'i')

内容的提问来源于stack exchange,提问作者Yosuf Hariq

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 21:15:35