lord.fist
lord.fist

Reputation: 435

BigQuery - UNION on left side of JOIN == Unexpected. Please try again

I have a problem with this query:

select 
sviEventoviFull.site_sectionid as site_sectionid,
sviEventoviFull.ev_date as ev_date,
sum(sviEventoviFull.total_views) as actualTotalViews,
sum(sviEventoviFull.total_visits) as actualTotalVisits,
sum(sviEventoviFull.total_time) as actualTotalTime,
sum(sviEventoviFull.realUserCount) as actualRealUserCount from
(select userid,site_sectionid,
    ev_date,
    total_views,
    total_visits,
    total_time,
    1 as realUserCount from
    DotMetric_TEST.EV_03112012,
    DotMetric_TEST.EV_04112012)

as sviEventoviFull 

join
    (
    select userid from DotMetric_TEST.UserSettings where 
    q1=100 
    and 
    q2=213 
    and 
    geo_code in (7,6,1,2)
    ) 
    as patternTablica
    on sviEventoviFull.userid =patternTablica.userid 
    where  sviEventoviFull.site_sectionid in (1,2,3,4,5,6,7,8,11,123)
    group by site_sectionid,ev_date

It keeps telling me "Error: Unexpected. Please try again.".

Same query without UNION works as expected:

select 
sviEventoviFull.site_sectionid as site_sectionid,
sviEventoviFull.ev_date as ev_date,
sum(sviEventoviFull.total_views) as actualTotalViews,
sum(sviEventoviFull.total_visits) as actualTotalVisits,
sum(sviEventoviFull.total_time) as actualTotalTime,
sum(sviEventoviFull.realUserCount) as actualRealUserCount from
(select userid,site_sectionid,
    ev_date,
    total_views,
    total_visits,
    total_time,
    1 as realUserCount from
    DotMetric_TEST.EV_03112012)

as sviEventoviFull 

join
    (
    select userid from DotMetric_TEST.UserSettings where 
    q1=100 
    and 
    q2=213 
    and 
    geo_code in (7,6,1,2)
    ) 
    as patternTablica
    on sviEventoviFull.userid =patternTablica.userid 
    where  sviEventoviFull.site_sectionid in (1,2,3,4,5,6,7,8,11,123)
    group by site_sectionid,ev_date

Please help us with this and how to use UNION and JOIN together. UNION on left side of join should be very common request!

Upvotes: 0

Views: 302

Answers (1)

Jordan Tigani
Jordan Tigani

Reputation: 26637

This is a known bug, we're working on the fix. I'll update this thread when the fix has been released.

Upvotes: 1

Related Questions