How to get several columns from BigQuery?

≯℡__Kan透↙ 提交于 2019-12-07 03:13:19

does this work?

SELECT type, created_at, repository_name 
FROM [githubarchive:github.timeline]
WHERE
    (created_at CONTAINS '2012-')
AND repository_owner="twitter"
GROUP BY type,created_at, repository_name;

I'm not sure I understand exactly what you're hoping to accomplish, but it is possible to get columns via something like this:

SELECT type, bootstrap, commons, twui
FROM   (
       SELECT type,
              SUM(IF(repository_name = 'bootstrap', 1, 0)) AS bootstrap,
              SUM(IF(repository_name = 'commons', 1, 0)) AS commons,
              SUM(IF(repository_name = 'twui', 1, 0)) AS twui
       FROM   [githubarchive:github.timeline]
       WHERE  created_at CONTAINS '2012-'
       AND    repository_owner = "twitter"
       GROUP BY type
       )
ORDER BY type
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!