Personal reports. Conclusion of dialogues
emmalee last edited by
There are two tables.
- view (boolean) 1/0
In fact, there are no problems with the conclusion of this particular dialogue/addition of communications, etc. There is a problem with the withdrawal of the list of dialogues. I mean, from me to the loop, and from the petition to me, it's one dialogue, and how to make a request like that? It's more important to sum up unreaded messages (view) in this dialogue only from an interviewer (excluding his own).
There's got to be something like,
- Negotiator [Peta], unreaded communications , id interviewer. =2
- Negotiator [all], unreported , id interviewer.=3
- Negotiator [January], unreported , id interviewer.=4
- Negotiator [Cole], unreaded communications , id interviewer.=5
select name,sum(not_view) msg_cnt,int_id from ( select if(from_id=1,to_id,from_id) int_id, 1-view not_view from prmess where from_id=1 or to_id=1 ) A join users2 on id=int_id group by int_id