BigQuery中范围查询中每个表的任何Group By和Aggregate函数?

时间:2017-09-19 06:39:04

标签: google-bigquery

我正在从下面的查询中寻找每个表的聚合函数(sum / avg)。

选择   总和(数量) 从   TABLE_QUERY([black-resource-174911:owner],' table_id CONTAINS" sales2017"') category =' shoes'

我期待:

总和表

100 sales2017W1 200销售2017W2 250 sales2017W3

BigQuery中有没有这样的选项?感谢帮助。

1 个答案:

答案 0 :(得分:2)

以下是BigQuery Standard SQL

  
for (i = 0; i < input.length; i++) { 
  if(rand[i] == input[i].value.toUpperCase()) {                     
    if(countClick == 1) {
      // Here the background will become green when its correct
      input[i].value = rand[i];
      var input1 = document.hetForm.L01;
      input1[i].value = rand[i];
      input[i].style.background = "green";
      input1[i].style.background = "green";                 
    }

    if(countClick == 2) {
      input[i].value = rand[i];
      var input2 = document.hetForm.L02;
      input2[i].value = rand[i];
      input[i].style.background = "green";
      input2[i].style.background = "green";
    }

    if(countClick == 3) {
      input[i].value = rand[i];
      var input3 = document.hetForm.L03;
      input3[i].value = rand[i];
      input[i].style.background = "green";
      input3[i].style.background = "green";
    }

    if(countClick == 4) {
      input[i].value = rand[i];
      var input4= document.hetForm.L04;
      input4[i].value = rand[i];
      input[i].style.background = "green";
      input4[i].style.background = "green";
    }

    if(countClick == 5) {
      input[i].value = rand[i];
      input[i].style.background = "green";
    }

    // If it is the right letter, put green background on it
    input[i].style.background = "green";
    good++;
  } else {
    if(rand.indexOf(invoer[i].value)) {
      input[i].style.background = "yellow";
    } else {
      alert(input[i].value);    
    }
  }
}