我的表格如下: -
+----+-------+
| ID | Score |
+----+-------+
| 3 | -10 |
| 2 | -11 |
| 4 | -9 |
| 5 | 1 |
| 1 | 12 |
+----+-------+
,我期待输出
+----+-------+
| ID | Score |
+----+-------+
| 1 | 12 |
| 2 | -11 |
| 3 | -10 |
| 4 | -9 |
| 5 | 1 |
+----+-------+
虽然我有查询
SELECT *
FROM Table
ORDER BY
ABS(score) DESC;
我希望用JPQL / JPA替换它。
答案 0 :(得分:1)
Query query=em.createQuery("SELECT p FROM Product p WHERE ABS(p.price)<50.0");
来自source