title: Syntax error using INNER JOIN and SqlDataSource with MySQL
body: <p>I am trying to write an update command that joins 2 tables using an <code>SqlDataSource</code>. I have it working with 1 table, but when I put my <code>INNER JOIN</code> syntax in I get thrown an error. It says &quot;<em>My syntax is wrong. Check MySql manual for correct syntax</em>&quot;</p>
  <p>Here is my Code from my ASPX page.:</p>
  <pre><code>    &lt;asp:SqlDataSource ID=&quot;AdminSalesmanDetailDS&quot; runat=&quot;server&quot; 
          ConnectionString=&quot;&lt;%$ ConnectionStrings:intelliairConnectionString %&gt;&quot; 
          ProviderName=&quot;&lt;%$ ConnectionStrings:intelliairConnectionString.ProviderName %&gt;&quot; 
          SelectCommand=&quot;individual_AddressByIndividualID&quot; 
          SelectCommandType=&quot;StoredProcedure&quot; 
          UpdateCommand=&quot;UPDATE individual SET
            FarmName = @FarmName,
            FirstName = @FirstName, 
            MiddleName = @MiddleName,
            Address1 = @Address1,
            City = @City
            INNER JOIN address a ON i.IndividualID = a.IndividualID,
           WHERE IndividualID=@IndividualID&quot;&gt;
          &lt;SelectParameters&gt;
              &lt;asp:ControlParameter ControlID=&quot;gvSalesman&quot; Name=&quot;oIndividualID&quot; 
                  PropertyName=&quot;SelectedValue&quot; Type=&quot;Int32&quot; /&gt;
          &lt;/SelectParameters&gt;
            &lt;UpdateParameters&gt;
     
            &lt;asp:ControlParameter Name=&quot;FarmName&quot; ControlId=&quot;fvAdminSalesmanDetail$CompanyTextBox&quot; PropertyName=&quot;Text&quot;/&gt;
            &lt;asp:ControlParameter Name=&quot;FirstName&quot; ControlId=&quot;fvAdminSalesmanDetail$FirstNameTextBox&quot; PropertyName=&quot;Text&quot;/&gt;
            &lt;asp:ControlParameter Name=&quot;MiddleName&quot; ControlId=&quot;fvAdminSalesmanDetail$MiddleNameTextBox&quot; PropertyName=&quot;Text&quot;/&gt;
            &lt;asp:ControlParameter Name=&quot;Address1&quot; ControlId=&quot;fvAdminSalesmanDetail$Address1TextBox&quot; PropertyName=&quot;Text&quot;/&gt;
            &lt;asp:ControlParameter Name=&quot;City&quot; ControlId=&quot;fvAdminSalesmanDetail$cityTextBox&quot; PropertyName=&quot;Text&quot;/&gt;
        &lt;/UpdateParameters&gt;
       
  
      &lt;/asp:SqlDataSource&gt;
  </code></pre>
  <hr />
  <p><strong>UPDATE</strong></p>
  <p>I have it working with 2 tables now. However it updates every Individual in the Table. For example: I am trying to update 1 person and I change the first name to Mark. When I click update , it changes everyone in the Database First Name to Mark.</p>
  <p>Here is my new Code from my ASPX page.:</p>
  <pre><code>    &lt;asp:SqlDataSource ID=&quot;AdminSalesmanDetailDS&quot; runat=&quot;server&quot; 
          ConnectionString=&quot;&lt;%$ ConnectionStrings:intelliairConnectionString %&gt;&quot; 
          ProviderName=&quot;&lt;%$ ConnectionStrings:intelliairConnectionString.ProviderName %&gt;&quot; 
          SelectCommand=&quot;individual_AddressByIndividualID&quot; 
          SelectCommandType=&quot;StoredProcedure&quot; 
       UpdateCommand=&quot;UPDATE individual i
           inner join address a
           on a.individualID =  i.individualID 
          set 
          
          i.FarmName = @FarmName,
          i.FirstName = @FirstName,
          i.LastName = @LastName,
          i.MiddleName = @MiddleName,
          i.Phone = @Phone, 
          i.PhoneExtention = @PhoneExtention,
          i.MobilPhone = @MobilPhone,
          i.Fax = @Fax, 
          i.Email = @Email,
          
          a.Address1 = @Address1,
          a.Address2 = @Address2,
          a.City = @City,
          a.State = @State,
          a.Zip = @Zip,
          a.Country = @Country
          where 
          i.IndividualID = i.IndividualID&quot;&gt;
          &lt;SelectParameters&gt;
              &lt;asp:ControlParameter ControlID=&quot;gvSalesman&quot; Name=&quot;oIndividualID&quot; 
                  PropertyName=&quot;SelectedValue&quot; Type=&quot;Int32&quot; /&gt;
          &lt;/SelectParameters&gt;
            &lt;UpdateParameters&gt;
     
            &lt;asp:ControlParameter Name=&quot;FarmName&quot; ControlId=&quot;fvAdminSalesmanDetail$CompanyTextBox&quot; PropertyName=&quot;Text&quot;/&gt;
            &lt;asp:ControlParameter Name=&quot;FirstName&quot; ControlId=&quot;fvAdminSalesmanDetail$FirstNameTextBox&quot; PropertyName=&quot;Text&quot;/&gt;
            &lt;asp:ControlParameter Name=&quot;MiddleName&quot; ControlId=&quot;fvAdminSalesmanDetail$MiddleNameTextBox&quot; PropertyName=&quot;Text&quot;/&gt;
            &lt;asp:ControlParameter Name=&quot;Address1&quot; ControlId=&quot;fvAdminSalesmanDetail$Address1TextBox&quot; PropertyName=&quot;Text&quot;/&gt;
            &lt;asp:ControlParameter Name=&quot;City&quot; ControlId=&quot;fvAdminSalesmanDetail$cityTextBox&quot; PropertyName=&quot;Text&quot;/&gt;
        &lt;/UpdateParameters&gt;
       
  
      &lt;/asp:SqlDataSource&gt;
  </code></pre>