title: MySql update. difference between procedure results and phpmyadmin sql
body: <p>I am having difficult getting a procedure to update a table in the way I require. I am using phpmyadmin on my local computer. In phpmyadmin I can put the following code into the SQL tab and one row will be updated:</p>
  
  <pre><code>SET `adjCost` = 22.05 WHERE `Name` LIKE CONCAT('magic', '%') AND `idKey` = '2016fulham02345';
  </code></pre>
  
  <p>As expected and wanted, IF the name begins with magic AND the idKey is '2016fulham02345' THEN the adjCost is updated to 22.05.</p>
  
  <p>There will be between 2 and 50 rows with the same idKey. The Name will never be repeated in a set with the same idKey.</p>
  
  <p>I created a procedure with the following parameters:</p>
  
  <pre><code>IN idK VARCHAR 255 Charset    
  IN aName VARCHAR 255 Charset    
  IN cost FLOAT 5,2
  
  BEGIN 
      UPDATE `raceresults` SET `adjCost` = cost WHERE `Name` LIKE CONCAT(aName, '%') AND `idKey` = idK; 
  END
  </code></pre>
  
  <p>When I run this procedure it updates ALL adjCost where the idKey = idk and (seems) to ignore the name parameter.</p>
  
  <p>I have tried concatenating the name string first:</p>
  
  <pre><code>BEGIN 
      SELECT CONCAT(aName, '%') INTO @str; 
      UPDATE `raceresults` SET `adjCost` = cost WHERE `Name` = @str AND `idKey` = idK; 
  END
  </code></pre>
  
  <p>but to no avail.</p>
  
  <p>I looked through w3schools, stackoverflow and google and have not been able to find the answer.</p>
  
  <p>My question is:</p>
  
  <p>How can I correct my procedure to get it to work as I would like?</p>
  
  <p>UPDATE: as requested.</p>
  
  <pre><code>    CREATE DEFINER=`root`@`localhost` PROCEDURE `importAltUpdateAjdCost`(IN `idK` VARCHAR(255), IN `aName` VARCHAR(255), IN `cost` FLOAT(5,2))
      NO SQL
  BEGIN
  UPDATE `costingPP`
  SET `adjCost` = cost
  WHERE 
  `Name` LIKE CONCAT(aName, '%')
  AND
  `idKey` = idK;
  END
  </code></pre>
  
  <p>To get this, I selected export on my list of procedures on phpmyadmin.</p>