Newbi (6/28/2016)
It will b better of with looking up UNION and UNION ALL first.I really am not aware of importance of order in group by. Those are not intentionally order that way.
Anyway Thank you.
Itemcode and ItemName are switched in the unioned queries.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden