title: MySQL: Growth in Column Value for Given Foreign Key and Specific Date Range
body: <p>I have a table in my database that I update every day with the amount of pins on Pinterest for a given URL (page_id).  <strong>How do I write a query that will return the page_id with the largest growth for a given date range?</strong></p>
  
  <p>Typically, I plan on setting the @StartDate = YESTERDAY and setting the @EndDate = Today, but I'd like the flexibility to adjust the dates within my query.</p>
  
  <p>Here is the current schema of my pins table:</p>
  
  <pre><code>mysql&gt; describe pins;
  +---------+---------+------+-----+---------+----------------+
  | Field   | Type    | Null | Key | Default | Extra          |
  +---------+---------+------+-----+---------+----------------+
  | id      | int(11) | NO   | PRI | NULL    | auto_increment |
  | page_id | int(11) | NO   | MUL | NULL    |                |
  | date    | date    | YES  |     | NULL    |                |
  | pins    | int(11) | YES  |     | NULL    |                |
  +---------+---------+------+-----+---------+----------------+
  </code></pre>
  
  <p>Here is the desired output of the query I need your help with: </p>
  
  <pre><code>mysql&gt; [fancy-mysql-query] ORDER BY Pins_DayOverDay DESC LIMIT 1;
  
  +-------------------+---------------------------+
  | page_id           | Pins_DayOverDay           |
  +-------------------+---------------------------+
  |             12345 |                     12345 |
  +-------------------+---------------------------+
  </code></pre>
  
  <p>Any help would be much appreciated!</p>