title: MySQL: Select all fields while defining a variable?
body: <p>Very simple concept. I am selecting specific rows based on the date they where generated (X days ago) and organizing them by the time frame (in this case, the variable is OVERDUEDAYS). The only problem I am having now is defining OVERDUEDAYS and also selecting the entire rows content without having to define each column in the select statement.</p>
  
  <p>Without further ado (this is what I am hoping to achieve):</p>
  
  <pre><code>SELECT DATEDIFF(CURDATE(), DATE(date_generated)) AS OVERDUEDAYS, * FROM invoices WHERE 
      (DATE(date_generated) = DATE_SUB(CURDATE(), INTERVAL 10 DAY) 
  OR 
      DATE(date_generated) = DATE_SUB(CURDATE(), INTERVAL 30 DAY)
  OR
  DATE(date_generated) = DATE_SUB(CURDATE(), INTERVAL 45 DAY)
  OR
      DATE(date_generated) = DATE_SUB(CURDATE(), INTERVAL 53 DAY)
  OR
      DATE(date_generated) = DATE_SUB(CURDATE(), INTERVAL 60 DAY))
  AND 
      (paid=0 AND cancelled=0)
  </code></pre>
  
  <p>The query works great when you remove the wildcard and define each column manually... But that is a lot of columns and I would like to avoid that at all costs. Suggestions?</p>