select event_id, contact_id, event_contact_status, count(*) from event_contacts where deleted=0 group by event_id, contact_id, event_contact_status having count(*) >1 --- TEST SITE SELECT event_id, contact_id, event_contact_status, count( * ) FROM event_contacts WHERE deleted =0 AND date_modified != '2014-09-15 00:00:00' GROUP BY event_id, contact_id HAVING count( * ) >1 -- HONBAN SITE select event_id, contact_id, event_contact_status, count(*) from event_contacts where deleted=0 and date_modified !='2014-10-31 00:00:00' group by event_id, contact_id having count(*) >1 SELECT * FROM event_contacts WHERE deleted=0 AND event_id=' AND contact_id=' SELECT * FROM event_contacts WHERE deleted=0 AND event_id='10c5a69d-f463-8f01-463d-5469c59cc963' AND contact_id='1414491' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='12294c16-5d5d-41a7-3e00-546d819d8156' AND contact_id='1509423' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='14829be6-d0a3-a05f-187a-5438e7c989b2' AND contact_id='547266b7-d6ce-b276-2d0d-5476ebfd320b' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='2d23d787-05e1-4c31-6b7a-5461cf4f0300' AND contact_id='1458929' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='2d7000f7-106b-b401-6cbd-544df2e298a5' AND contact_id='1436183' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='54d621ec-080c-c9bf-49e4-54585dc0a6bf' AND contact_id='1405171' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='7f808ec7-d3f7-a107-aa53-5470846c71b5' AND contact_id='1115236' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='7f808ec7-d3f7-a107-aa53-5470846c71b5' AND contact_id='1124626' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='809aa26b-16c4-2904-801b-543f716d0655' AND contact_id='1323897' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='9bf8197b-02cc-d33d-f8a2-54701640e84f' AND contact_id='1304672' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='baab79de-a406-19f3-e122-5448d648581a' AND contact_id='1300136' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='baab79de-a406-19f3-e122-5448d648581a' AND contact_id='1441655' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='cf480b08-f59f-4523-d509-5461de9b76b2' AND contact_id='1466927' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='d4d3b227-abf5-59a7-26ba-546b0a0832f9' AND contact_id='1461431' ORDER BY `event_contacts`.`date_modified` DESC ; two records with status 2 !!! SELECT * FROM event_contacts WHERE deleted=0 AND event_id='dadc0af5-663f-dba0-3538-5465f449807b' AND contact_id='1441767' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='df900a41-953a-d275-21fd-54420cd7c231' AND contact_id='309169' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='e5f7c98a-eb9e-507b-05c3-546332c87984' AND contact_id='1005523' ORDER BY `event_contacts`.`date_modified` DESC SELECT * FROM event_contacts WHERE deleted=0 AND event_id='e8370f0b-3903-e986-eba4-545de39c9007' AND contact_id='1399563' ORDER BY `event_contacts`.`date_modified` DESC select event_id, contact_id, event_contact_status, count(*) from event_contacts, smsevent_sub1 where event_contacts.deleted=0 AND event_contacts.event_id=smsevent_sub1.id_sub1 AND smsevent_sub1.nenki='201501' group by event_id, contact_id having count(*) >1