Jump to content
Fórum Script Brasil
  • 0

Duvida Em Sql


frnd
 Share

Question

Seguinte, tenho essa SQL

select t1.tempo, t2.* from noticia t2,informacao t1 left outer join avaliacaoinf t3 on (t2.idinformacao = t3.idinformacao) where t1.idinformacao = t2.idinformacao

dá o erro 1054 - Unknown column 't2.idinformacao' in 'on clause'

mas na tabela noticia já existe o campo 'idinformacao', oque pode ser?

[]s

Edited by frnd
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

tente invertendo a ordem de t1 e t2

select t1.tempo, t2.* from informacao t1, noticia t2 left outer join avaliacaoinf t3 on (t2.idinformacao = t3.idinformacao) where t1.idinformacao = t2.idinformacao
Se não funcionar voce precisa fazer JOIN entre t2 e t3 e depois t2 e t1. assim:
select t1.tempo, t2.* from noticia t2 LEFT OUTER JOIN avaliacaoinf t3 ON (t2.idinformacao = t3.idinformacao) INNER JOIN informacao t1 ON (t1.idinformacao = t2.idinformacao)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...