当我运行此代码时:
# get sample databases from: http://chinookdatabase.codeplex.com/
library(dplyr)
mydb <- src_sqlite("Chinook_Sqlite.sqlite")
Album <- tbl(mydb, "Album")
ArtistIds <- Album %>% select(ArtistId) %>% distinct(ArtistId) %>% collect()
我收到此错误:
Error: Can't calculate distinct only on specified columns with SQL
为什么呢?我该如何解决?
谢谢!
答案 0 :(得分:1)
您需要省略distinct(ArtistId)
- 以下似乎可以完成这项工作:
tbl(mydb, "Album") %>%
select(ArtistId) %>%
distinct()
埃纳尔