-1
I have a table that connects two other tables. "Request" it links "Customers" and "Solitation_description"
It has the cliente_id link columns and request_descricao_id, I need to return clients who have more than one specific request from the table as shown in the figure below.
I need to create an sql that I put "Where requecao_descricao_id = 19 and requeca_descricao_id = 8 and requecao_descricao_id = 13" and return this client 1. But don’t know how to do anyone can help me? Because I want customers who have these 3 requests together. If I use the "OR" returns me several that I don’t need and AND returns nothing!
You want to make the customer 1 (
cliente_id
) without filtering it, filtering only bysolicitacoes_descricao_id
?– Daniel Mendes
With a group by us cliente_id and only filtering the request
– Gustavo Alexandre
How is your query today? How you tried to do?
– Daniel Mendes
I made the junctions of the tables and gave a Where with the filters separated by "AND" but then it does not return anything.. pq is not in msm line. I have no idea how to do.
– Gustavo Alexandre
It is impossible that the field
solicitacao_descricao_id
contains 3 distinct values simultaneously (19, 8 and 13). You may want to useOR
and notAND
.– anonimo