-2
我有一個postgres查詢,我想用JPA執行。Postgres查詢到JPA轉換
任何一個可以告訴我如何在JPA糾正下面的查詢
SELECT (
SELECT COUNT(*)
FROM "RECEIPT" Where "STATUS"='1'
) AS count1,
(
SELECT COUNT(*)
FROM "RECEIPT" Where "STATUS"='1'
) AS count2;
這將返回
count1 count2
11 11
在JPA我試過以下。
Query query = em.createQuery("SELECT (SELECT count(*) FROM SMSReceipt Where status='1') AS count1,(SELECT count(*) FROM SMSReceipt Where status='8') AS count2 ");
但是,這是行不通的
請建議我該怎麼辦呢
Thankyou so much it worked :) – kirti