title: MySQL/phpmyadmin issue: Searching for number
body: <p>I have a database where two of the tables have columns called Building Code. It is set as VARCHAR(5) in both of them, and sometimes the value is purely digits (ex: 0001) and sometimes it has a letter in it (ex: 0170A)</p>
  
  <p>The two different tables in this database, are called "buildings", and "newconnections", of which I am trying to perform an inner join on.</p>
  
  <p>In one of the tables, when I search for 0001 in phpmyadmin I get no results, but if I search for 0170A I get the correct results. In the other table, both work correctly. This issue has been affecting me as I have been trying to do an inner join on these data sets. </p>
  
  <p>I have tried using LTRIM, RTRIM (this did not work), I tried casting as VARCHAR(5) (although admittedly this query just wasn't producing results so I may had done it wrong).</p>
  
  <p>Here is the inner join I am trying to perform if it helps:</p>
  
  <pre><code>"SELECT BUILDING_CODE, buildings.BuildingName, buildings.Latitude, buildings.Longitude, FLOOR1, FLOOR2, FLOOR3 
      FROM buildings LEFT JOIN
      (SELECT BUILDING_CODE, 
          SUM(IF(FLOOR_NUMBER = '1', FLOORCONNECTIONS, 0) ) AS FLOOR1,
          SUM(IF(FLOOR_NUMBER = '2', FLOORCONNECTIONS, 0) ) AS FLOOR2,
          SUM(IF(FLOOR_NUMBER = '3', FLOORCONNECTIONS, 0) ) AS FLOOR3
          FROM
          (
              SELECT 
              BUILDING_CODE, FLOOR_NUMBER, COUNT(*) AS FLOORCONNECTIONS
              FROM newconnections GROUP BY BUILDING_CODE, FLOOR_NUMBER
          ) as totals
          GROUP BY BUILDING_CODE
      ) as r ON RTRIM(BUILDING_CODE) = RTRIM(buildings.BuildingCode)";
  </code></pre>
  
  <p>For instance, on the table that is giving me troubles: </p>
  
  <p><code>SELECT * FROM newconnections WHERE BUILDING_CODE = '0170A'</code></p>
  
  <p>returns results but </p>
  
  <p><code>SELECT * FROM newconnections WHERE BUILDING_CODE = '0001'</code></p>
  
  <p>returns nothing. </p>
  
  <p>On the working table: </p>
  
  <p><code>SELECT * FROM newconnections WHERE BuildingCode= '0170A'</code> </p>
  
  <p>and </p>
  
  <p><code>SELECT * FROM newconnections WHERE BuildingCode= '0001'</code> </p>
  
  <p>return results</p>
  
  <p>EDIT: A little more information. I actually generated a lot of this data using a script that I created and was inserting it into a text file and then inserting it into a database from that file. I guess there must be some weird issue with how it was printing certain numbers - I put my data this time into excel and exported it into a table from there and I added that table to my database and the queries run fine now, so case closed (although I wish I could figure out how to actually fix this problem for future references).</p>