SELECT SQL WITH WHERE "DOUBLE"

Asked

Viewed 476 times

-5

I am trying to make a query in the Mysql database with the following syntax

SELECT id, codigo, faca, descricao, vendedor, imagem 
FROM produtos
WHERE sit = 1
  AND descricao = ESTE

Even that part works perfectly : SELECT id, codigo, faca, descricao, vendedor, imagem FROM produtos WHERE sit = 1

But the query presents the following error when I put the last part of the code : #1054 - Coluna 'ESTE' desconhecida em 'where clause'

  • 5

    THIS not apparently should come between simple quotes, like this and descricao = 'ESTE', is like this?

1 answer

2

The mistake is exactly what Ricardo pointed out in a comment; how is in the select, ESTE is syntax of a table column produtos, and such a column does not exist (says the error).

Apparently you compare yourself to the column descricao has THIS as value, then the query would be like:

SELECT id, codigo, faca, descricao, vendedor, imagem 
FROM produtos
WHERE sit = 1
  AND descricao = 'ESTE'

Browser other questions tagged

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