My query works, and looks like this:
SELECT
SUM(`WTE`) / 1000 AS WTE
FROM `orthoptists` AS o
LEFT JOIN `instances` AS i
ON o.instance_FK = i.id
WHERE i.region = 14 AND o.band = "D" AND o.age = "A" ;
I have 10 possible values each for o.band and o.age, and I need the result of this query for each permutation of those two values.
I am very new to SQL: is there a way to use a sub-query to produce all the results for one value in o.band (say)? Or even to do the whole lot in one go?
Performance isn’t important in this: convenience is.
Try this