-1

I want to convert this query to HQL syntax please:

SELECT count(*) from ( SELECT count(name) as tot FROM myTable WHERE id = 1 GROUP BY name ) as src;

UPDATE

I found a way to do it : based on Count the number of groups in HQL Query?

this query SELECT count(name) as tot FROM myTable WHERE id = 1 GROUP BY name return me a List and then i do a .size(). it works for me !

soufian97
  • 39
  • 3
  • SO, is not intended for query conversion. Try to read the [documentation](https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#hql) at first. – SternK Mar 17 '21 at 10:50
  • Maybe this link can help you. refer to it [how do i convert SQL query to HQL](https://stackoverflow.com/questions/48209762/how-do-i-convert-sql-query-to-hql) – Sathya Mar 17 '21 at 10:50

1 Answers1

0

Please ry this:

SELECT count(mt) as tot FROM myTable mt WHERE mnt.id = 1