我是SQL的新手...请不要介意我是否要求愚蠢的问题.. 这是我的第一个Query,它应该基于代码执行数据 WHERE hits.transaction.transactionId IS NOT NULL
我有多个SELECT,FROM和WHERE语句。我该如何纠正这个。
SELECT
date,fullvisitorid AS Users,
hits.product.v2ProductName AS Product_Name,
(hits.product.productPrice/1000000) AS Product_Price,
(hits.product.productQuantity) AS Product_Quantity,
(hits.product.productrevenue/1000000) AS Product_Revenue
FROM ([DATASET])
WHERE hits.transaction.transactionId IS NOT NULL
-------------------------------------------------------------------
SELECT
hits.eCommerceAction.action_type AS Product_Viewed
FROM ([DATASET])
WHERE hits.eCommerceAction.action_type = '2'
答案 0 :(得分:0)
你可以把它结合起来像
SELECT
date,fullvisitorid AS Users,
hits.product.v2ProductName AS Product_Name,
(hits.product.productPrice/1000000) AS Product_Price,
(hits.product.productQuantity) AS Product_Quantity,
(hits.product.productrevenue/1000000) AS Product_Revenue,
hits.eCommerceAction.action_type AS Product_Viewed
from ([DATASET])
WHERE hits.transaction.transactionId IS NOT NULL
AND
hits.eCommerceAction.action_type = '2'
答案 1 :(得分:0)
如果要在WHERE
子句中组合多个条件,请使用AND/OR个关键字。
SELECT
date,fullvisitorid AS Users,
hits.product.v2ProductName AS Product_Name,
(hits.product.productPrice/1000000) AS Product_Price,
(hits.product.productQuantity) AS Product_Quantity,
(hits.product.productrevenue/1000000) AS Product_Revenue,
hits.eCommerceAction.action_type AS Product_Viewed
FROM ([DATASET])
WHERE hits.transaction.transactionId IS NOT NULL
AND
hits.eCommerceAction.action_type = '2'