English 中文(简体)
我们能够通过加入大公国和后来的选连任获得多种条款
原标题:Can we have multiple WITH Clauses in BigQuery and then SELECT by joining

Is it possible to have multiple WITH clause statements in the BigQuery editor with #standardSQL e.g:

#StandardSQL

#features
WITH features AS (
SELECT
fullVisitorId,
IFNULL(totals.bounces, 0) AS bounces,
IFNULL(totals.timeOnSite, 0) AS time_on_site
FROM
`data-to-insights.ecommerce.web_analytics`
WHERE
totals.newVisits = 1
AND date BETWEEN  20160801  AND  20170430 );

# features labels
WITH features_label AS ( 
SELECT
fullvisitorid,
IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit
FROM
`data-to-insights.ecommerce.web_analytics`
GROUP BY fullvisitorid);


# Combine features with feature labels for model training
SELECT * EXCEPT(fullVisitorID)
FROM features
JOIN features_label
USING (fullVisitorId);

我正在带错<代码>Syntax错误:未预料的“;”在[13:44]上,但无法确定多条<代码>与之间。 条款是行不通的。

问题回答

以下简称表

WITH features AS (
  SELECT
  fullVisitorId,
  IFNULL(totals.bounces, 0) AS bounces,
  IFNULL(totals.timeOnSite, 0) AS time_on_site
  FROM `data-to-insights.ecommerce.web_analytics`
  WHERE totals.newVisits = 1
  AND date BETWEEN  20160801  AND  20170430 
), features_label AS ( 
  SELECT
  fullvisitorid,
  IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit
  FROM `data-to-insights.ecommerce.web_analytics`
  GROUP BY fullvisitorid
)
SELECT * EXCEPT(fullVisitorID)
FROM features
JOIN features_label
USING (fullVisitorId)




相关问题
How to write to second tree in Firebase Realtime Database

I have a Firebase Realtime Database and I want to write to it, that s simple enough, but I have added more than one tree to my Database and want to know how to write to the second tree. Right now I ...

Azure Lifecycle Management Rule

I am attempting to set up an Azure Lifecycle Management rule. I want to move my active/Hot files/blobs that are over 90 days old to an Archive tier. I tried walking through the Lifecycle Management ...

热门标签