• ...

    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?

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]