1
I was working with mysql in this project and the query worked normally. At the moment, I am migrating to postgresql. However, the query stopped working and returned 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);
I think we missed the "on" of the doctor'.
– Motta