为每个值添加多个列

时间:2017-12-04 19:33:37

标签: mysql r multiple-columns

我对R-Studio有疑问。

我写了以下查询:

var1 <- dbGetQuery(con, 'select sum(table1.amount) as x,
      mid(table3.date,6,2) as month from table2, table3, table1 where
      table3.id = table1.bnr and table1.tnr = table2.tnr and
      table1.tnr = "123" and mid(table3.date,1,4) = "2016"
      group by month order by month ASC')

它会输出一个包含两个属性(a和月)的表。

如何编辑表格,使其包含所有table.tnr(不仅仅是“123”)的值,而无需手动添加每列?

谢谢!

0 个答案:

没有答案