【问题标题】:When I type in the all_sessions_raw query, Why do I keep getting an error message saying Syntax Error: Unexpected Keyword TO at [3:11]当我输入 all_sessions_raw 查询时,为什么在 [3:11] 不断收到一条错误消息,提示语法错误:意外关键字 TO
【发布时间】:2021-08-04 23:49:13
【问题描述】:

我想在 Google Cloud Platform 上执行以下 BigQuery 语句:

#standardSQL
SELECT 
  COUNT(*) as num_duplicate_rows, * 
FROM
  data-to-insights.ecommerce.all_sessions_raw
GROUP BY
  fullVisitorId, channelGrouping, time, country, city,
  totalTransactionRevenue, transactions, timeOnSite, pageviews,
  sessionQualityDim, date, visitId, type, productRefundAmount,
  productQuantity, productPrice, productRevenue, productSKU,
  v2ProductName, v2ProductCategory, productVariant, currencyCode,
  itemQuantity, itemRevenue, transactionRevenue, transactionId,
  pageTitle, searchKeyword, pagePathLevel1, eCommerceAction_type,
  eCommerceAction_step, eCommerceAction_option
HAVING 
  num_duplicate_rows > 1;

我收到以下错误消息:

语法错误:意外的关键字 TO 在 3:11

我目前正在尝试在 Google Cloud Platform 上使用 BigQuery,但它失败并出现上述错误。我该如何解决这个问题?

【问题讨论】:

  • 您的项目data-to-insights 需要用反引号`data-to-insights` 括起来。或者你可以把整个东西都附上……`data-to-insights.ecommerce.all_sessions_raw`.

标签: google-cloud-platform google-bigquery


【解决方案1】:

请尝试使用以下查询。对我有用。

SELECT COUNT(*) as num_duplicate_rows, * 
FROM `data-to-insights.ecommerce.all_sessions_raw` 
GROUP BY fullVisitorId, channelGrouping, time, country, city, totalTransactionRevenue, transactions, timeOnSite, pageviews, sessionQualityDim, date, visitId, type, productRefundAmount, productQuantity, productPrice, productRevenue, productSKU, v2ProductName, v2ProductCategory, productVariant, currencyCode, itemQuantity, itemRevenue, transactionRevenue, transactionId, pageTitle, searchKeyword, pagePathLevel1, eCommerceAction_type, eCommerceAction_step, eCommerceAction_option HAVING num_duplicate_rows > 1

问题是您没有将 project.dataset.table_name 包含在反引号 (`) 中。

【讨论】:

    猜你喜欢
    • 2021-10-08
    • 1970-01-01
    • 2021-07-15
    • 1970-01-01
    • 1970-01-01
    • 2014-04-12
    • 1970-01-01
    • 1970-01-01
    • 2014-10-03
    相关资源
    最近更新 更多