📜  findTopFiveBestSeller - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:48.434000             🧑  作者: Mango

代码示例1
@Repository
public interface ProductRepository extends JpaRepository {

    @Query(value = "select top 5 p.name, sum(po.quantity) as total_quantity from product p " +
            "inner join productorder po " +
                "on p.id = po.product_id " +
            "group by p.id, p.name " +
            "order by total_quantity desc", nativeQuery = true)
    List findTopFiveBestSeller();
}