I have this kinda query:
SELECT
IF(daycode=1,(SELECT...),(SELECT...)) AS weekavg,
(SELLOFF1 / weekavg) AS procent
FROM .....
it tells me: Unknown column 'weekavg' in 'field list', this happens after I’ve added the divide, prior to that worked ok.
You can use a sub-query: