title: #1054 - Unknown column 'general' in 'where clause'
body: <p>I have a problem that I did not understand; why can the column not be used?  Here is my code:</p>
  
  <pre><code>SELECT `a`.`id`, `a`.`title`, `e`.`url` as category, 
    calc_val(`a`.`value`, `c`.`prof`, `c`.`tax`) as general, 
    `a`.`date`, `a`.`url`, 
    SUM(`d`.`stock`) as stock 
  FROM (`produc` as a) 
  LEFT JOIN `prod_c` as b ON `a`.`id` = `b`.`p_id` 
  LEFT JOIN `p_calc` as c ON `a`.`id` = `c`.`p_id` 
  LEFT JOIN `p_opt` as d ON `a`.`id` = `d`.`p_id` 
  LEFT JOIN `categ` as e ON `b`.`categ_id` = `e`.`id` 
  LEFT JOIN `prod_aval` as `f` ON `a`.`id` = `f`.`p_id` 
  WHERE `b`.`categ_id` = '1' 
    AND `a`.`active` = 'y' 
    AND `d`.`stock` &gt;= 1 
    AND general BETWEEN '10' AND '50' 
  GROUP BY `a`.`id` 
  LIMIT 9
  
  calc_val = routine:
  
  begin
      declare value real;
      set value = v+(v*l/100);
      return value+(value*i/100);
  end
  </code></pre>