I have 2 tables: MailFile and Responder.
Need a report that shows the following:
Qty Mailed will be a count where country = Greece for 1st row, Malaysia for 2nd row and Singapore for 3rd row from mailfile table.
Active and Inactive will be a count of each in the responder table where couponcode matches in both tables.
Non-responder will be where there is NO Match in the 2 tables. Did not know whether a PIVOT command would work in SQL or not.
I am not 100% sure I understand your question but here is an attempt at a solution (it does not use PIVOT and has some assumptions about your column types)... I believe you are looking for each country, along with a total number of codes, total number of active codes, total number of inactive codes, and total number of unknown codes that you are referring too as non-responders. Note that this code was tested on SQL 2008. I do not see any reason why it would not be backwards compatible with SQL 2005.
answered May 08, 2010 at 01:29 AM