title: How to do simple math in an SQL SELECT query?
body: <p>I need to select all products whose fields conform to a simple mathematical expression (in my case, division).</p>
  
  <p><strong>Example Query:</strong><br /></p>
  
  <pre><code>SELECT * FROM cars WHERE (retail_price/invoice_price)&gt;1.05
  </code></pre>
  
  <p><strong>Needs to be flexible:</strong><br />
  I need flexibility here because I wish to be able to define the expression as a string somewhere else and just pop it in the SQL query after the WHERE clause.</p>
  
  <pre><code>$expression = "(retail_price/invoice_price)&gt;1.05";
  $query = "SELECT * FROM cars WHERE ".$expression." LIMIT 1";
  </code></pre>
  
  <p><strong>Notes:</strong> <br />
  - Data type of retail_price is VARCHAR <br />
  - Data type of invoice_price is VARCHAR<br />
  - Not sure if VARCHAR is suitable for monetary values though..</p>
  
  <p>Any suggestions? Because the above did not work for me. (Returned zero results)</p>