Oracle 获取下一个值的select 语句

原创
2019/06/12 16:34
阅读数 329
-- Next Operation
SELECT m.operation_no
FROM   Shop_Order_Operation_Tab m
WHERE  operation_no = ( SELECT  MIN(s.operation_no)
                        FROM    Shop_Order_Operation_Tab s
																								WHERE   s.operation_no > 10
																								AND     s.order_no = m.order_no
                      )
AND    order_no = 'SO1905150001'

-- Last Operation
SELECT m.operation_no
FROM   Shop_Order_Operation_Tab m
WHERE  operation_no = ( SELECT  MAX(s.operation_no)
                        FROM    Shop_Order_Operation_Tab s
                        WHERE   s.operation_no < 20
                        AND     s.order_no = m.order_no
                      )
AND    order_no = 'SO1905150001'

 

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部