Не могу решить проблему, все работает корректно на базе Н2, на базе mssql вылетает ошибка (должна обязательно быть mssql).
Column 'personal.id' is invalid in the select list because it is not contained
in either an aggregate function or the GROUP BY clause
Вот Query
@Query(value = "SELECT p
from Inspection i
left join i.cohort c left join i.personal p
left join fetch p.personal ip left join fetch ip.transfer t
left join fetch t.profession left join fetch t.department
left join fetch p.outsidePersonal op left join fetch op.organisation
where (:personalType is null or p.type = :personalType)
and (:department is null or t.department=:department)
and (:organisation is null or op.organisation=:organisation)
and (:unit is null or i.unit = :unit)
and (:dateFrom is null or i.date>=:dateFrom)
and (:dateTo is null or i.date<=:dateTo)
and (:controlType is null or c.parent=:controlType)
and (:measureType is null or i.cohort=:measureType) group by p",
countQuery = "select count(p) from Inspection i
left join i.cohort c left join i.personal p left join p.personal ip
left join ip.transfer t left join p.outsidePersonal op
where (:personalType is null or p.type = :personalType)
and (:department is null or t.department=:department)
and (:organisation is null or op.organisation=:organisation)
and (:unit is null or i.unit = :unit) and (:dateFrom is null
or i.date>=:dateFrom) and (:dateTo is null or i.date<=:dateTo)
and (:controlType is null or c.parent=:controlType)
and (:measureType is null or i.cohort=:measureType) group by p")
Если убрать из запроса первый group by p тогда все работает и на mssql. Кто знает как решить данную проблему?
Современные инструменты для криптотрейдинга: как технологии помогают принимать решения
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости