首页 > 代码库 > oracle 多对一时只去前两条数据sql

oracle 多对一时只去前两条数据sql

 (select table5.shopareaid,table5.usersid ,table5.username  from   (select sg.shopareaid,u1.usersid,u1.username,row_number() OVER(PARTITION BY sg.shopareaid ORDER BY sg.shopareaid desc) numbers from shops s, shopgroup sg,users u1 where s.shopgroupid = sg.shopgroupid and   u1.companysid=7 and u1.usertitle = 40 and u1.status<=2 and s.shopsid=u1.residentshopid) table5 where table5.numbers=1) table1,

 

.

oracle 多对一时只去前两条数据sql