Tsql T-SQL从值条件开始选择

Tsql T-SQL从值条件开始选择,tsql,select,conditional-statements,Tsql,Select,Conditional Statements,在SQLServer2008中,我有下表 谢谢 create table test1 ([Number] int, Item varchar(10)) insert into test1 values (20 , 'Item 1'),(30 , 'Item 2'),(60 , 'Item 3'),(23 , 'Item 4'),(10 , 'Item 5'),(76 , 'Item 6'),(44 , 'Item 7'),(99 , 'Item 8'),(10 , 'Item 9'),(22 ,

在SQLServer2008中,我有下表

谢谢

create table test1 ([Number] int, Item varchar(10))
insert into test1 values (20 , 'Item 1'),(30 , 'Item 2'),(60 , 'Item 3'),(23 , 'Item 4'),(10 , 'Item 5'),(76 , 'Item 6'),(44 , 'Item 7'),(99 , 'Item 8'),(10 , 'Item 9'),(22 , 'Item 10'),(77 , 'Item 11'),(10 , 'Item 12')
如果没有特定的主键,表中的数据就没有固有的顺序,例如,将每条记录想象成一张纸,没有特定的顺序倾倒在篮子中

select a.*--, b.pvt
from test1 a
inner join (select MIN(1*substring(item,6,10)) pvt from test1 where number=10) b
    on 1*substring(a.item,6,10) >= b.pvt
order by 1*substring(a.item,6,10)
我做出了以下假设:

订单由项目编号确定,其中 项目编号始终是项目列中第6个字符之后的数字
如果假设是错误的,那么您仍然可以使用类似的技术,即查找关键记录并使用>=

连接到它。您如何确定项目的顺序?