我在求仓库别数量的最大值与最小值时,
用下记语句,我发现有FIRST与用LAST求出的值是一样的,
因刚学分析函数,对这个逻辑不是太了解,请教:
select location_no,
max(qty_onhand) keep (dense_rank first order by location_no) maxv,
min(qty_onhand) keep (dense_rank last order by location_no) minv
from inventory_part_in_stock_loc
group by location_no
上述语句中,将FIRST改为LAST或将LAST改为FIRST,
结果都是一样的,WHY
用下记语句,我发现有FIRST与用LAST求出的值是一样的,
因刚学分析函数,对这个逻辑不是太了解,请教:
select location_no,
max(qty_onhand) keep (dense_rank first order by location_no) maxv,
min(qty_onhand) keep (dense_rank last order by location_no) minv
from inventory_part_in_stock_loc
group by location_no
上述语句中,将FIRST改为LAST或将LAST改为FIRST,
结果都是一样的,WHY
![33.gif](https://i-blog.csdnimg.cn/blog_migrate/b968e3c74f55b41e8be1caa4cbbe7ad2.png)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12391917/viewspace-247732/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12391917/viewspace-247732/