title: Mysql - On Duplicate Key Update not working for 2 keys
body: <p>Hello I have a table with two unique keys profile_id and date. I don't know where is the problem but my query is not working.</p>
  
  <p>Table:</p>
  
  <pre><code>CREATE TABLE `profile_views` 
      (\n  `id` int(11) NOT NULL AUTO_INCREMENT,
      \n  `profile_id` varchar(45) DEFAULT NULL,
      \n  `counter` varchar(45) DEFAULT NULL,
      \n  `date` date DEFAULT NULL,
      \n  PRIMARY KEY (`id`),
      \n  UNIQUE KEY `date_UNIQUE` (`date`),
      \n  UNIQUE KEY `profile_id_UNIQUE` (`profile_id`)\n
      ) ENGINE=InnoDB AUTO_INCREMENT=150 DEFAULT CHARSET=latin1'
  </code></pre>
  
  <p>Data Right Now:</p>
  
  <pre><code># id , profile_id, counter, date
    113,      2    ,   36   , 2015-08-27
  </code></pre>
  
  <p>I issue this command:</p>
  
  <pre><code>INSERT INTO profile_views (profile_id, counter, date) 
  VALUES (2, 1, '2015-08-28') 
  ON DUPLICATE KEY UPDATE counter = counter+1;
  </code></pre>
  
  <p>And</p>
  
  <pre><code>INSERT INTO profile_views (profile_id, counter, date) 
  VALUES (2, 1, '2015-08-27') 
  ON DUPLICATE KEY UPDATE counter = counter+1;
  </code></pre>
  
  <p>In this query i just changed the date so it should insert new row.</p>
  
  <p>My Desired Results:</p>
  
  <p>If i change date still it changing the same profile id counter.
  I want to store everyday profile views for each profile id. So if the date and profile id is same its increment the counter otherwise insert new row.</p>
  
  <p>Any help? Thanks.</p>