Error: FROM keyword not found where expected

Asked

Viewed 171 times

0

I am trying to do the following Inner Join but am getting error:

FROM keyword not found where expected

select 
       e.num_exame as [exame], 
       a.num_amostra as [amostra], 
       e.data_hora_exame as [exame], 
       a.tipo_amostra as [amostra] 
from exame as e 
inner join amostra as a on e.num_exame = a.num_exame
group by e.num_exame, a.num_amostra, e.data_hora_exame, a.tipo_amostra
where upper (situacao_amostra) like upper ('%descartada%');

What is wrong?

  • What is that? Mysql, SQL Server, Oracle, Postgres?

  • I do not see any error except some particularity of the SQL dialect used in your DBMS, which you did not inform what it is. A curiosity: what is the reason for this clause GROUP BY if you do not use any aggregation function?

  • It’s Oracle. I tried to comment group by but gives the same error...

  • Are you sure of these brackets, the alias would not be in quotes (e.g.: "exam")?

  • I tried trading for quotes and gave error: SQL command was not finished correctly

1 answer

0

select e.num_exame       as exame, 
       a.num_amostra     as amostra, 
       e.data_hora_exame as dh_exame, 
       a.tipo_amostra    as tipo_amostra
  from exame e inner join amostra a on e.num_exame = a.num_exame
 where upper (situacao_amostra) like upper ('%descartada%')
 group by e.num_exame, a.num_amostra, e.data_hora_exame, a.tipo_amostra
  • Clause Where stood before group by, taken out of brackets, and "as" before tables

Browser other questions tagged

You are not signed in. Login or sign up in order to post.