Is this possible to create a query by JPA QueryBuilder
using query.from(subquery)
?
select DISTINCT substring(min(sel."order"), 2)
from
(SELECT s.name || d.name "name",
CASE
WHEN d.status = 'ACCEPTED' then '0ACCEPTED'
WHEN d.status = 'OPEN' then '1OPEN'
WHEN d.status = 'DISMISSED' then '2DISMISSED'
end "order"
FROM items AS d
LEFT JOIN store s ON d.store_id = s.id
WHERE ... ) sel
GROUP BY sel.name
please don't try to see logic in the query
I just want to know how to create such construction by query builder
select *
from (select something
from some table
where conditions)
if it is possible of course
I know how to use a subquery in the WHERE or the SELECT section. but I don't know how to use subquery inside the FROM expression