Google BigQuery - github时间轴表中的奇怪查询错误

时间:2014-09-29 19:51:45

标签: sql google-bigquery

我在Google Big Query服务中执行了一个查询,误解了错误

  

错误:表'evt'中找不到字段'evt.repository_name'。

,因为该字段存在于指向错误的表中。有人可以帮我解决这个问题吗?

查询:

    select nname 
    from (
         select evt.repository_name nname, count(evt.payload_issue_id) issues_count
         from [publicdata:samples.github_timeline] evt 
           where upper(repository_language)='JAVA'
          AND evt.repository_name in (
              select name from (

                     select evt1.repository_name name, count(evt1.payload_commit_id) commits_count
                     from [publicdata:samples.github_timeline] evt1 
                     where upper(repository_language)='JAVA'
                     group by name
                     order by commits_count desc 
                     limit 20  
                               ) 
             as foo2)    
    group by nname
    order by issues_count desc 
    limit 20 ) as foo

1 个答案:

答案 0 :(得分:1)

这个有效:

  select nname 
    from (
         select repository_name as nname, count(payload_issue_id) as issues_count
         from [publicdata:samples.github_timeline] as evt 
           where upper(repository_language)='JAVA'
          AND repository_name in (
              select name from (

                     select evt1.repository_name name, count(evt1.payload_commit_id) commits_count
                     from [publicdata:samples.github_timeline] evt1 
                     where upper(repository_language)='JAVA'
                     group by name
                     order by commits_count desc 
                     limit 20  
                               ) 
             as foo2)    
    group by nname
    order by issues_count desc 
    limit 20 ) as foo