close
今天同事突然問我之前有印Label
但每印一次就會跳一號而且不會記錄
只會留下最後列印的號碼
這樣跟上一個產品的號碼就會有不連續
想要找出到底有多少然後中間差多少號
想到有用過類似的.....
找了一下最後修改的結果如下.....
趕快記下來不然不用二天就又忘了
select a.cust_lot_id as code1, min(b.cust_lot_id) as code2, to_number(substr(min(b.cust_lot_id),-5,5)) - to_number(substr(a.cust_lot_id,-5,5)) as 相差 from asheet a,asheet b where a.cust_lot_id < b.cust_lot_id and a.cust_lot_id is not null and a.cust_lot_id like '%Y0L%' group by a.cust_lot_id having to_number(substr(min(b.cust_lot_id),-5,5)) - to_number(substr(a.cust_lot_id,-5,5)) > 1
結果:
全站熱搜
留言列表