I have a postgres query that i want to execute with JPA.
Can any one tell me how to right following query in jpa
SELECT (
SELECT COUNT(*)
FROM "RECEIPT" Where "STATUS"='1'
) AS count1,
(
SELECT COUNT(*)
FROM "RECEIPT" Where "STATUS"='1'
) AS count2;
This returns
count1 count2
11 11
In jpa i tried following.
Query query = em.createQuery("SELECT (SELECT count(*) FROM SMSReceipt Where status='1' ) AS count1,(SELECT count(*) FROM SMSReceipt Where status='8' ) AS count2 ");
But this is not working
Please suggest me how to do it