【发布时间】:2023-03-04 05:33:02
【问题描述】:
我不知道如何使用 Pageable 对象按计算列对列表进行排序。
示例:
select qte, price, (price * qte ) as total
from table
order by total
【问题讨论】:
标签: sql sorting spring-data spring-data-jpa
我不知道如何使用 Pageable 对象按计算列对列表进行排序。
示例:
select qte, price, (price * qte ) as total
from table
order by total
【问题讨论】:
标签: sql sorting spring-data spring-data-jpa
您不能在 order by 子句中引用别名。相反,你会使用:
SELECT qte, price, (price * qte) as total
FROM table
ORDER BY (price * qte)
【讨论】: