0
I need to use this Where in a query, but without success
With 'AND' does not work.
where ((`atributos_detalhes`.`keyValue` = 'dormitorios' and `relation_imovel_detalhes`.`value` in (2)) **AND**
(`atributos_detalhes`.`keyValue` = 'areaTerreno' and `relation_imovel_detalhes`.`value` > 0))
So it works with "or" between them, but not as you would like
where ((`atributos_detalhes`.`keyValue` = 'dormitorios' and `relation_imovel_detalhes`.`value` in (2)) **OR**
(`atributos_detalhes`.`keyValue` = 'areaTerreno' and `relation_imovel_detalhes`.`value` > 0))
My friend: you have to know a minimum of logic to know if you want to build your expression using the logical connectors AND or OR. There’s no sense in you replacing each other without knowing why.
– anonimo
I understand the logical operators, the point is that I need to use the AND, but the end doesn’t work, I can use the OR, but not as the AND would be. So I would like a way to make this possible. As described in the codes. Thank you for the answer.
– Tiago Henrique Oliveira
probably not that it doesn’t work, but all conditions together should not occur
– Ricardo Pontual
You start your comment with "I understand the logical operators" but what you put below gives the opposite impression. Without you describing what you want to get no one can opine on which of the two expressions you posted is correct or whether they are both wrong.
– anonimo
It makes no sense, in the first parentheses you have
keyValue = 'dormitorios'
, and in the secondkeyValue = 'areaTerreno'
, never both checks will return true, either is one or is another. If you want help, explain what each field is, show the table structure and exemplify the output you want– Costamilam