title: How to use if_else with sql query in RODBC package R
body: <p>I am using the RODBC package in R to run a SQL query. I'd like to add a simple condition to run this query. I am able to get results from the below query</p>
  
  <pre><code>library(RODBC)
  database1 &lt;- odbcConnect(dsn = "&lt;database_name&gt;")
  sqlQuery(database1, "SELECT * FROM TABLE")
  </code></pre>
  
  <p>But when I add an ifelse() statement to it, then it doesn't work</p>
  
  <pre><code>ifelse(1&lt;2, sqlQuery(database1, "SELECT * FROM TABLE"), "")
  </code></pre>
  
  <p>What really went wrong here?</p>
  
  <p>Unfortunately, I cannot produce a reproducible example as the question needs a database connection.</p>
  
  <p>Thanks!</p>