我有一个与1个输入参数配合使用的SQL查询 例如
mydf1=dbGetQuery(con2, paste0("select month from incoming where to_char(TO_TIMESTAMP(vessel_servertimestamp, 'YYYY-MM-DD HH24:MI:SS'), 'MON') in '",input$dataset1,"'
group by month "))
如何构造一个SQL查询以传递多个输入参数?下面是selectInput ..
output$dataset1 =renderUI({
selectInput("dataset1", "Choose month:",
choices = as.list(c("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP","OCT","NOV","DEC")),
multiple = TRUE)
})
答案 0 :(得分:1)
您需要将输入$ dataset的sql部分更改为
in (", paste0("'", input$dataset1, "'", collapse = ","), ") group_by month"