我有一个我不明白的问题;为什么不能使用列?这是我的代码:
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` >= 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