5
I have the following tables: negociacoes
, negociacao_contatos
and negociacao_status
and the following relationships:
negociacoes hasMany negociacao_contatos
negociacoes belongsTo negociacao_status
In negociacao_status
I have two fields: alerta_usuario
(Y/N) and prazo_alerta
(int).
I need to do a search (COUNT) of negociacoes
in which his status (negociacao.negociacao_status_id)
be it alerta_usuario = "Y"
and negociacao_contatos.created
is greater than prazo_alerta
.
That is, I need to count how many negotiations there are in which the last contact was held more than X days ago. How would be the most correct way to do this search? I have tried several alternatives, none successfully.
could you put an example of the tables and attributes in the question? It is easier to understand and assemble the answer
– Maicon Carraro
@Sneepsninja is there in the question
– Jorge B.