I'm inputting the following query but getting an error message that the table is not updateble?
SET @rownumber = 0;
UPDATE (
SELECT _atc_codes.se, diagnoses.*
FROM diagnoses
JOIN _atc_codes
ON (_atc_codes.id = diagnoses.atc_code)
ORDER BY _atc_codes.se, diagnoses.year, diagnoses.county, diagnoses.age_group, diagnoses.gender) AS b
SET b.base_order_index = (@rownumber:=@rownumber+1)
What I'm trying to achieve is to speed up my queries by adding a sequence column that I can sort my results on instead of sorting on multiple columns. It's based on an ORDER BY clause involving 5 columns, one of the from a JOINed table.