...
True but as I said there seems to be a bit of clarity needed on what the order should be. The MAT column is not ordered in the desired output.
then just:
ORDER BY [DVD] DESC, CASE WHEN MAT = 'Tot' THEN 1 ELSE 0 END
The MAT column will be ordered randomly, but Tot will still come as a last one per DVD.
I agree, that setup needs clarification about Total: is it already in a table or needs to be calculated?