Я пытаюсь создать союз между двумя таблицами, используя HQL (Hibernate Query Language).Этот сценарий SQL отлично работает на моем сервере SQL:
SELECT COUNT(DISTINCT linkedin_id) as test, school_name
FROM
(SELECT * FROM alum_education
UNION
SELECT * FROM alum_connection_educations) AS UNIONS where school_name='some string'
проблема в том, что когда я пытаюсь запустить его в виде грааля, вот так:
def countOfEdu = AlumEducation.executeQuery("select count (distinct linkedinId ) as countOfEdu, schoolName as SchoolName from (SELECT * FROM alumEducation UNION SELECT * FROM alumConnectionEducations) AS UNIONS where schoolName='some string'" )
я получаю эту ошибку:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 83 [select count(distinct linkedinId ) as countOfEdu, schoolName as SchoolName from (SELECT * FROM alumEducation UNION SELECT * FROM alumConnectionEducations) AS UNIONS where schoolName='Duquesne University']
Как выполнить оператор SQL в граалях?
спасибо Джейсон