0
select Document_id 
from Document_Master 
where Document_id like 'APJ1.000753%'

结果显示这样

APJ1.000753_DIS001.PDF

APJ1.000753_IP753_DIS001.PDF

APJ1.000753_IP753_OTH001(1).PDF

APJ1.000753_IP753_OTH001(2).PDF

APJ1.000753_IP753_OTH001.PDF

APJ1.000753_OTH001.PDF

但我想根据下划线计数,结果应该是

APJ1.000753_DIS001.PDF

APJ1.000753_OTH001.PDF

APJ1.000753_IP753_DIS001.PDF

APJ1.000753_IP753_OTH001(1).PDF

APJ1.000753_IP753_OTH001(2).PDF

APJ1.000753_IP753_OTH001.PDF
4

1 回答 1

2
select Document_id
from Document_Master
where Document_id like 'APJ1.000753%'
order by len(Document_id) - len(replace(Document_id, '_', '')), Document_id
于 2013-11-12T07:24:36.273 回答