保存谷歌大查询SQL的查看错误

时间:2017-05-17 10:38:41

标签: sql google-bigquery

我在google bigquery上有sql查询

SELECT distinct

 h.transaction.transactionId,
  Date,
  totals.pageviews,

  h.item.itemQuantity,
  h.transaction.transactionRevenue,
  totals.bounces,
  fullvisitorid,
  totals.timeOnSite,
  device.browser,
  device.deviceCategory,
  trafficSource.source,
  channelGrouping,
  h.page.pagePath,
  h.eventInfo.eventCategory,
  device.operatingSystem



FROM `atomic-life-148403.148778266.ga_sessions_*`,
UNNEST(hits) AS h


WHERE
  _TABLE_SUFFIX BETWEEN REPLACE(CAST(DATE_ADD(CURRENT_DATE(), INTERVAL -1 YEAR) AS STRING), '-','')
  AND CONCAT('intraday_', REPLACE(CAST(DATE_ADD(CURRENT_DATE(), INTERVAL 0 DAY) AS STRING), '-',''))
order by date

错误是:

错误:在第32行第75栏遇到“”年“”。期待:“)”......

但是,我看不出“年”有什么问题。 任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

您正在使用BigQuery Standard SQL,但在旧版SQL下运行。

转到

  • 显示选项
  • 取消选择SQL Dialog =使用旧版SQL

enter image description here