title: How to sum a generated column in MySQL?
body: <p>This query is working correctly, it generates a column called "total_each" I just want to sum all the values from that column and display them.</p>
  
  <p>I believe its a pretty simple thing but i can't find the appropriate way of writing it, I already looked everywhere.</p>
  
  <pre><code>select ((datediff(date1, date2))*daily_cost) as total_each
  from table1, table2, table3 
  where bid = fk1_bid 
  AND vid = fk2_vid 
  AND bid = 2;
  </code></pre>
  
  <p>I think the bottom line is I don't know how to apply the SUM function for the generated column.</p>