Pasting Values in SQL Query through R

前端 未结 2 1789
隐瞒了意图╮
隐瞒了意图╮ 2021-01-22 10:01

I have the following dataframe which contains the AxiomaID.

x<-c(0123, 234, 2348, 345, 3454)

And trying to run the following SQL Query withi

2条回答
  •  太阳男子
    2021-01-22 10:27

    Try the following query:

    SQL6<-data.frame(sqlQuery(myConn, paste("SELECT top 10 [AxiomaDate] 
      ,[RiskModelID]
      ,[AxiomaID]
      ,[Factor1]
       FROM [PortfolioAnalytics].[Data_Axioma].[SecurityExposures]
       Where AxiomaID IN (", paste(x, collapse = ", "), ")")))
    

    Hope it helps!

提交回复
热议问题