Необходимо извлечь верхнюю строку во внутреннем запросе в JPA, но выдает ошибку, когда я использую LIMIT во внутреннем запросе для извлечения верхней строки.
Запрос:
@Query("SELECT id, master_id, country_code, pricing_type, pricing_id, user_id,\r\n" +
" ( SELECT current_value FROM fzy_pricing_change_history ORDER BY created_on DESC LIMIT 1) AS current_value, previous_value,\r\n" +
" is_active, created_on FROM fzy_pricing_change_history WHERE user_id = :userId AND master_id = :masterId AND pricing_id = :pricingId ORDER BY created_on DESC LIMIT 1")
Журнал ошибок:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: LIMIT near line 2, column 83 [SELECT id, master_id, country_code, pricing_type, pricing_id, user_id,
~~~~~~~~~ ( SELECT current_value FROM fzy_pricing_change_history ORDER BY created_on DESC LIMIT 1) AS current_value, previous_value,
~~~~~~~~~ is_active, created_on FROM fzy_pricing_change_history WHERE user_id = :userId AND master_id = :masterId AND pricing_id = :pricingId ORDER BY created_on DESC LIMIT 1]
Пожалуйста, предоставьте любое приспособление к тому же или любую альтернативу, чтобы найти тот же результат.