Have the query:
SELECT *
FROM cliente,
categoria_cliente,
categoria
WHERE categoria_cliente_cliente_id = cliente_id
and categoria_id = categoria_cliente_categoria_id
and (categoria_cliente_categoria_id = 1 OR categoria_cliente_categoria_id = 2)
GROUP BY cliente_id
If I do it with OR
in WHERE
, it works perfectly, but if I change the OR
by AND
there is no record.
What I need in question is the following:
Bringing the clients that are in the categoria_cliente
table, in this table, has the column categoria_cliente_cliente_id
and categoria_cliente_categoria_id
, with OR
I'm bringing clients that are in category 1 or 2, but with AND
I want to bring only customers who are in category 1 and 2.