Categories
How to formulate column select query, subquery(count()) with CriteriaQuery?
SELECT t.id, t.title, (SELECT COUNT(t2.t2_id) FROM table2 t2 WHERE (t2.t2_id = t.id)) FROM table1 t
Answer the question
In order to leave comments, you need to log in
Not ready to say how to shift to CriteriaQuery, but the query can be rebuilt to: SELECT t.id, t.title, COUNT(t2.t2_id) FROM table1 t left join table2 t2 on (t2.t2_id = t.id) could be like this it will be easier to implement in CriteriaQuery
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question