title: Joining Tables with MYSQL queries in VBA (excel)
body: <p>I am completely new to Visual Basic. I am working with a MYSQL data base and I want to use VB in excel so I can work with more complex queries. For some reason, when I try to join tables in vb, I get an error message. Can somebody tell me what is wrong with my code.</p>
  
  <pre><code>strSql = "SELECT COUNT(*)FROM `order`" &amp; _
                   "JOIN user ON user.id = order.destination_id" &amp; _
                   "WHERE payment_status = 'pay';"
  
      rs.Open strSql, oConn, adOpenDynamic, adLockPessimistic
  
      res = rs.GetRows
  
      rs.Close
  
      Range("A1", "A6") = res(0, 0)
  </code></pre>