Mysql Rank / Lead来自不同表的等价物

时间:2018-01-24 15:16:16

标签: mysql sql mysql-workbench rank

下面是MSSQL。我试图找到以下查询的MySQL等价物:

select distinct inv.name as InvName  

    ,slotapproval.value 
    ,rank() over (partition by inv.name,slots.customerid order by cast(slots.date as date) desc)  as RankDESC  
    ,rank() over (partition by inv.name,slots.customerid order by cast(slots.date as date) asc)  as RankASC    
    from slotapproval  
    INNER JOIN slots ON slots.slotid=slotapproval.slotid  
    INNER JOIN inv ON slotapproval.invid=inv.invid  

基本上我正在尝试排序desc / Asc。非常感谢任何帮助

0 个答案:

没有答案