Q&A for anime and manga fans
declare @t table ( orderId int, code_dest char(1) ) declare @t2 table ( ID_VOIT int, orderId int, code_dest char(1) ) insert into @t values (1, 'a') insert into @t values (2, 'b') insert into @t values (3, 'c') insert into @t values (4, 'a') insert into @t values (5, 'a') insert into @t values (6, 'b') insert into @t values (7, 'g') select * from @t order by code_dest