title: 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code. Additional information: Incorrect syntax near 'b'
body: <p>I keep getting this error and I have checked my code several times to find a solution but to no avail.</p>
  
  <pre><code>private void PopulateotherNames()
  {
      string query = "SELECT a nickName FROM otherNames a" +
                     "INNER JOIN nameNicki b ON a.Id = b.otherNamesId" +
                     "WHERE b.realNameId=@realNameId";
  
      using (connection = new SqlConnection(connectionString))
      using (SqlCommand command = new SqlCommand(query, connection))
      using (SqlDataAdapter adapter = new SqlDataAdapter(command))
      {
          command.Parameters.AddWithValue("@realNameId", listRealName.SelectedValue);
  
          DataTable NickNameTable = new DataTable();
          adapter.Fill(NickNameTable);
  
          listNickName.DisplayMember = "nickName";
          listNickName.ValueMember = "Id";
          listNickName.DataSource = NickNameTable;
      }
  }
  </code></pre>