我有一个脚本在Hadoop Impala中作为SQL查询工作,但是当我尝试使用RODBC包在R中运行时,如果" sum"功能如下:
install.packages("RODBC")
library(RODBC)
conn <- odbcConnect("ODBC Impala")
example1 <- sqlQuery(conn, "
select
column1 as Name, column2 as Date, sum(column3) as Balance
from
database1.table1
where
column2="20151130"")
但是,当我排除:
sum(column3) as Balance
脚本运行得很好。有人可以帮忙吗?
答案 0 :(得分:3)
据推测,您需要group by
:
select column1 as Name, column2 as Date, sum(column3) as Balance
from database1.table1
where column2 = '20151130'
group by column1, column2;