• Hi Rodrigo,

    Craig has a point and we might need more information. The following query works with the sample data but might not be exactly what you need.

    SELECT *

    FROM #item

    ORDER BY ROW_NUMBER() OVER(PARTITION BY num ORDER BY (SELECT NULL)), num

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2