title: database query to get lowest price based on last crawel date
body: <p>I would like to get lowest price of product based on last crawled dates by various resellers. My current function is very basic, it gets me lowest price from table without considering reseller ids and crawled timestamps.</p>
  
  <p>I've rough idea that we can <code>SELECT * FROM "custom_data_table"</code> and process the data using php. Please have a look at attachment for further clarification.</p>
  
  <pre><code>function get_lowest_price($table_id) {
      global $wpdb;
      $table_prices = $wpdb-&gt;get_results(
          $wpdb-&gt;prepare(
              "SELECT price FROM `custom_data_table` WHERE tableid= %d"
              ,$table_id)
      );
      if (!empty($table_prices) &amp;&amp; $table_prices !== NULL) 
          return rtrim(min($table_prices)-&gt;price, '00');
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/yZtiW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yZtiW.png" alt="enter image description here"></a></p>