Mysql group by multiple combinations
check it here if it is what you're asking for: http://rextester.com/TVOKS20933

select enquiry_id, from_user, to_user, count(1) msg 
from replies
group by enquiry_id, from_user, to_user
order by id;

+----+--------+-----------+---------+------+
| id | enq_id | from_user | to_user | msg  |
+----+--------+-----------+---------+------+
| 1  | 1      | 1         | 2       | msg1 |
+----+--------+-----------+---------+------+
| 2  | 1      | 2         | 1       | msg2 |
+----+--------+-----------+---------+------+
| 3  | 1      | 1         | 2       | msg3 |
+----+--------+-----------+---------+------+
| 4  | 1      | 2         | 1       | msg4 |
+----+--------+-----------+---------+------+
| 5  | 1      | 1         | 3       | msg1 |
+----+--------+-----------+---------+------+
| 6  | 1      | 3         | 1       | msg2 |
+----+--------+-----------+---------+------+    

+--------+-----------+---------+-----+
| enq_id | from_user | to_user | msg |
+--------+-----------+---------+-----+
| 1      | 1         | 2       | 2   |
+--------+-----------+---------+-----+
| 1      | 2         | 1       | 2   |
+--------+-----------+---------+-----+
| 1      | 1         | 3       | 1   |
+--------+-----------+---------+-----+
| 1      | 3         | 1       | 1   |
+--------+-----------+---------+-----+