I was working with mysql on this project and the query worked normally. At the moment, I'm migrating to postgresql. However, the query stopped working and returns the following error:
ERROR: syntax error at or near "WHERE"
My code
@Query(value = "SELECT b.nome FROM escala a INNER JOIN medico b "
+"INNER JOIN ordem c ON c.medico_crm = b.crm AND a.id = c.escala_id "
+"WHERE month(a.data) = :mes AND year(a.data) = :ano AND "
+ "b.categoria = :categoria group by b.nome", nativeQuery=true)
Set<String> getNomeMedicos(@Param("mes") int mes, @Param("ano") int ano, @Param("categoria") String categoria);