ORDER BY table 结构而不是数字

ORDER BY table structure instead of numerical

我当前的 MsSQL 查询如下所示:

all =  'SELECT Master_Sub_Account , cAccountTypeDescription , Debit , Credit FROM [Kyle].[dbo].[PostGL] AS genLedger'\
                ' Inner JOIN [Kyle].[dbo].[Accounts] '\
                'on Accounts.AccountLink = genLedger.AccountLink '\
                'Inner JOIN [Kyle].[dbo].[_etblGLAccountTypes] as AccountTypes '\
                'on Accounts.iAccountType = AccountTypes.idGLAccountType'\
                ' WHERE genLedger.AccountLink not in (161,162,163,164,165,166,167,168,122)'\
                ' AND genLedger.TxDate > ?'\
                ' ORDER BY iAccountType'

我需要 ORDER BY iAccountType 来显示数据放置在 table 中的顺序,而不是数字。

目前输出看起来像这样(见账户列)

但我需要它看起来像这样:

根据随附的屏幕截图,它按“帐户”列 (ASC) 排序。那是你需要的吗?如果是,那么您必须使用 ASC 关键字。

这是一个例子:

create table #tmpTable (col1 varchar(10))

insert into #tmpTable
values ('3020>010')
 ,('2750>020')
 ,('1000>180')
 ,('1000>001')
 ,('3620>011')
 ,('3200')
 ,('3850')

 select col1
 from #tmpTable
 order by col1 asc

 drop table #tmpTable

结果必须是:

1000>001
1000>180
2750>020
3020>010
3200
3620>011
3850