I am looking to get the card id, typecommunication and date created for only those card ids who have at least one of each typecommunication = CMR or Bounced Mail. select cardid, typecommunication, datecreated from rxc_communications where typecommunication in ('Bounced Mail', 'CMR') group by cardid having count(typecommunication) >1 This is not working.
select cardid, typecommunication, datecreated from rxc_communications where typecommunication in ('Bounced Mail', 'CMR') and count(typecommunication) >1 group by cardid
not sure i understand correctly what you are trying to achieve but... select cardid, typecommunication, datecreated from rxc_communications where cardid in (select cardid from rxc_communications where typecommunication='Bounced Mail') and cardid in (select cardid from rxc_communications where typecommunication='CMR') dirty and slow but might do (if i understood the problem correctly)