以下查询不起作用(使用旧版SQL)
SELECT
*
FROM (
SELECT
ClientID,
hitnumber,
(
SELECT
cd.value
FROM
h.customDimensions AS cd
WHERE
cd.index=1 ) AS user
FROM
[xxxx:yyyy.ga_sessions_20180823] AS t,
t.hits AS h
LIMIT
1000 )
WHERE
user IS NOT NULL
但是可以(标准SQL)
select *
From(SELECT
ClientID,
hitnumber,
(SELECT cd.value
FROM h.customDimensions AS cd
WHERE cd.index=1 ) AS user
FROM
`yyyy.ga_sessions_20180823` AS t, t.hits as h
)
where user is not null
如果错误是由于语法引起的,我会理解的,但是显示的错误是
错误:找不到:数据集xxxx:yyyy
答案 0 :(得分:2)
问题在这里:
SELECT
ClientID,
hitnumber,
-- this part
(
SELECT
cd.value
FROM
h.customDimensions AS cd
WHERE
cd.index=1 ) AS user
FROM
[xxxx:yyyy.ga_sessions_20180823] AS t,
t.hits AS h
LIMIT
1000
您无法在旧版SQL的选择列表中使用子查询,因此尽管会引起误解,但最终会出现错误。最好的选择是对您的查询使用标准的SQL,因为BigQuery团队现在只为该SQL方言开发功能和提高性能。