title: MySQL - get date column from a table
body: <p>I have a MySQL db with a MappingTable which consists of two columns. First column is a <code>date</code> column and another is ID - <code>Autoincrement</code> int column. I created this table for mapping dates and the ID's. When I query the date column with dates to retrieve the ID, no rows are getting selected. Any reason?</p>
  
  <p>I tried</p>
  
  <ol>
  <li><code>date_format</code> in the SELECT query</li>
  <li><code>str_to_date</code> while checking in the WHERE clause</li>
  <li>Compared like <code>current_date &gt; "2016-07-12"</code> AND <code>current_date &lt;= "2016-07-12"</code></li>
  </ol>
  
  <p>IfI compare <code>LIKE "2016-07-1%"</code> I'm getting matching rows but if I select <code>"2016-07-12%"</code> though there are matching rows, it is giving 0 rows. </p>
  
  <p>I defined my column as <code>DATE</code> only. </p>
  
  <p>Anything I'm missing here? </p>
  
  <pre><code>CREATE TABLE `mapping_table` (
     `Current_date` date DEFAULT NULL,
     `id` int(11) NOT NULL AUTO_INCREMENT,  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>My question is, I want to select something like this.</p>
  
  <p><code>select id from mapping_table where current_date="2016-07-12";</code></p>
  
  <p>I tried with all approaches as mentioned above, but no rows are not retrieving. </p>