title: RODBC ERROR: Could not SQLExecDirect in mysql
body: <p>I have been trying to write an R script to query Impala database. Here is the query to the database:</p>
  
  <pre><code>select columnA, max(columnB) from databaseA.tableA where columnC in (select distinct(columnC) from databaseB.tableB ) group by columnA order by columnA 
  </code></pre>
  
  <p>When I run this query manually (read: outside the Rscript via impala-shell), I am able to get the table contents. However, when the same is tried via the R script, I get the following error:</p>
  
  <pre><code>[1] "HY000 140 [Cloudera][ImpalaODBC] (140) Unsupported query."       
  [2] "[RODBC] ERROR: Could not SQLExecDirect 'select columnA, max(columnB) from databaseA.tableA where columnC in (select distinct(columnC) from databaseB.tableB ) group by columnA order by columnA'
  closing unused RODBC handle 1
  </code></pre>
  
  <p>Why does the query fail when tried via R? and how do I fix this? Thanks in advance :)</p>
  
  <p><strong>Edit 1:</strong></p>
  
  <p>The connection script looks as below:</p>
  
  <pre><code>library("RODBC");
  connection &lt;- odbcConnect("Impala");
  query &lt;- "select columnA, max(columnB) from databaseA.tableA where columnC in (select distinct(columnC) from databaseB.tableB ) group by columnA order by columnA";
  data &lt;- sqlQuery(connection,query);
  </code></pre>