1
我正在通過sql執行此操作,但是我想在hql中執行此操作,select(select count(*)...)中的語句不適用於hql,任何消化和優化將不勝感激將sql轉換爲hql
SELECT u.username,u.device_tocken,sr.count
from users u,
(select count(*) as count ,ssr.recepient as res from survey_recipient ssr where
(ssr.is_read is false and ssr.recepient in ('abc','xyz'))group by ssr.recepient) sr
where
(u.username = sr.res and u.device_tocken is not null)