select * from (SELECT ROW_NUMBER() OVER (ORDER BY B.OrderID) as num, B.*
FROM
(SELECT h.OrderNumber,k.OrderID,k.OrdeMumber,k.CustomerName,k.ProductCode
from sales_orderinfo as h right join orderdetail as k on k.OrderID = h.ID
) B ) tb where tb.num BETWEEN 1 AND 5
注意用左连接还是右连接根据实际情况而定