title: How to inner join with PyODBC
body: <p><strong>UPDATE</strong> I updated my code and the error I am receiving.</p>
  
  <p>I'm not exactly sure how to use <code>INNER JOIN</code> with Python's pypyODBC.</p>
  
  <p>I am getting an error that says </p>
  
  <blockquote>
    <p>"Cannot find either column "UT" or the user-defined function or aggregate,  "UT.userID", or the name is ambigous."</p>
  </blockquote>
  
  <p>I've tried specifying the table in the SELECT statement.</p>
  
  <p>Any suggestions on how I can fix this?</p>
  
  <pre><code>import pypyodbc
  
  def intercard():
  
      firstname = "Paul"
      key = "334" 
  
      try:
          connection = pypyodbc.connect('Driver={SQL Server};Server=MyServerName;Database=MyDatabaseName;Trusted_Connection=yes;')
      except pypyodbc.Error as ex:
          sqlstate = ex.args[0]
          if sqlstate == '28000':
              print("You do not have access.") 
      cursor = connection.cursor() 
      SQLCommand = ("SELECT UT.userID, Status, userName "      
          "FROM dbo.StatusTable as ST INNER JOIN dbo.UserTable as UT "   # table name
          "ON ST.userID=UT.userID"
          "(nolock)"
          "WHERE userKey LIKE ? AND First Name LIKE ?")
      Values = ['%' + key + '%', '%' + firstname + '%']
      cursor.execute(SQLCommand,Values)
      results = cursor.fetchone()
      if results:
          print(connections + " " + str(results[0]) + " " + str(results[1])) # enters results in entry
          connection.close()
  </code></pre>
  
  <p>I just want to connect to both the <em>StatusTable</em> and <em>UserTable</em>.</p>
  
  <p>** UPDATE 2 **</p>
  
  <p>I can run the below directly in SQL Server and it works.  But I can't get it working in Python...</p>
  
  <pre><code>SELECT ST.[userID]
  
    FROM [dbo].[StatusTable] as ST INNER JOIN [dbo].[UserTable] as UT
    ON ST.userID = UT.userID
  
    where Name = 'Paul'
  </code></pre>