Help converting SQL query to JPQL -
I have a SQL query that I have to translate to JPQL, and I wonder if it is the case with which I originally For reference, we have to use SQL, here is the SQL query.
select c.title, a.approval_total, r.requested_total code from INNER JOIN (SELECT code_id, year, SUM (request_amount) requested by total request request group code_id, year) C.id = r.code_id INNER (select Code_ID, year, SUM (approved_America) approved by the Total Code Group code_id, year) on one c.id = a.code_id WHERE c.title =? And r.fiscal_year =? And a.fiscal_year =?
Does anyone know how to translate the line view into JPQL in these two? Or alternatively, there is a different way of structuring a query that makes translating easier?
I rewrite SQL query without first using inline selection
Not sure if I write it correctly, but it will be something like this:
select c.title, sum (a.approved_amount) _total as the approval, SUM (r) .requested_amount) as request_total code c requests from INNER requests are accepted at c.id = r.code_id INNER c.id = a.code_id WHERE c.title =? And r.fiscal_year =? And a.fiscal_year =? Group by RCode_ID, R.Uyear, A CDIID, AuR
Comments
Post a Comment