Hello,
I was wondering if the following mysql query can be constructed in a much more efficient way?
SELECT distinct(cr.email), m.fname, m.lname, m.email, (SELECT count(*) FROM campaignRecipts where email=cr.email )as ttlsent, (SELECT count(received) FROM campaignRecipts where received='yes' and email=cr.email )as ttlreceived, ((SELECT count(received) FROM campaignRecipts where received='yes' and email=cr.email )/(SELECT count(*) FROM campaignRecipts where email=cr.email ))*100 as percentage FROM campaignRecipts as cr, maillist as m where cr.email=m.email group by ttlsent asc
Additionally, how could I round up the percentage --all within the query...
I appreciate any thoughts on this!
Best,