我有一个数据集,我试图将特定列的内容传递到 SQL where 语句中。
例如,假设 iris 是我的数据集
data(iris)
head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa
Run Code Online (Sandbox Code Playgroud)
我想将 Species { setosa, setosa, setosa.....setosa} 列的内容传递给我的 sql 查询 where 语句
sqlQuery(abcd, paste("Select * from TestTableName1
where WHERE DESCRIPTION
IN (values of Species column from r dataframe)");
Run Code Online (Sandbox Code Playgroud)
这里需要帮助