title: MySQL: SELECT * FROM table WHERE field="some text" doesn't work
body: <p>I am trying to INNER JOIN two tables on a text field, but I can't get it to work.
  I've backtracked to see if I can identify where my query is falling down.
  I've simplified my query to use only one table, to see if I can select data from it based on a text string.
  I can't make it work.
  I feel like an <em>idiot</em>.
  This is so basic, why isn't it doing it?</p>
  
  <pre><code>select * from `my-table`
  where myKey = "some-text-data-that-i-copied-from-the-data-in-the-table";
  </code></pre>
  
  <p>Returns no rows.
  "some-text-data-that-i-copied-from-the-data-in-the-table" is in field myKey. I can see it. It's in the table!!!</p>
  
  <p>[if it makes any difference I am most familiar with using an Access front-end and I am porting my "skills" to MySQL because MySQL is just better really.. this seems like the most run of the mill SELECT statement ever and yet it doesn't do anything!]</p>
  
  <p>EDIT:</p>
  
  <p>IMSoP does this help any...</p>
  
  <pre><code>select * from mymathssowlink
  where MyMathsResourceKey = 'KS2-Number-Counting and Place Value-NC3-Negative Numbers 1';
  </code></pre>
  
  <p>EDIT 2:</p>
  
  <p>Diego Marinelli - thanks - this returns data</p>
  
  <pre><code>select * from mymathssowlink
  where MyMathsResourceKey like '%KS2%';
  </code></pre>
  
  <p>EDIT 3:</p>
  
  <p>This works...</p>
  
  <pre><code>select * from mymathssowlink
  where MyMathsResourceKey like '%KS2-Number-Counting and Place Value-NC3-Negative Numbers 1%';
  </code></pre>
  
  <p>EDIT 4: </p>
  
  <p>But this still doesn't...</p>
  
  <pre><code>select * from mymathssowlink
  where MyMathsResourceKey = 'KS2-Number-Counting and Place Value-NC3-Negative Numbers 1';
  </code></pre>
  
  <p><em>puzzled</em></p>
  
  <p>Table:</p>
  
  <pre><code>CREATE TABLE `mymathssowlink` (
    `ID` int(11) NOT NULL AUTO_INCREMENT,
    `ObjectiveID` varchar(13),
    `MyMathsResourceKey` varchar(100),
    PRIMARY KEY (`ID`),
    UNIQUE KEY `idnew_table_UNIQUE` (`ID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>HOW IT GOT FIXED:</p>
  
  <p>okay very weird but I have fixed the simplified problem now! I remember from my Access days that trailing spaces are the bane of matches and it seems the MySQL is a bit fiddly in this regard to. There was no problem with the data as such but the field MyMathsResourceKey was the last bit of data on each line and so not terminated with a comma. Some lines didn't have any data in that column and so were terminated with a comma rather than the MyMathsResourceKey data. I fixed it by adding a third column to my csv into which i uniformly stuck the string "PLACEHOLDER". I matched this to a column called <code>placeholder</code> in the table receiving the data. Now that the active (2nd column) is always terminated with a comma all the data seems to work. I can't help thinking that this is a bit odd and that MySQL data imports really don't want to be behaving like this... now to try an make my JOIN work, which how this all started!</p>
  
  <p>Thanks to all, especially Rahul for the help.</p>
  
  <p>... and the JOIN Works now...</p>