Mysql 4

SELECT c.campaign_name, count(*), c.id FROM addresses as a  INNER JOIN
addresses_incampaign as i on (a.email_address = i.email_address)  INNER JOIN
campaigns as c on (i.campaign_id = c.id) WHERE a.user_id = "1" AND i.user_id
= "1" GROUP BY c.id ORDER BY c.id

This gives me 
FooNmae         100
BarName         250
FUD name        127

Within the addresses table is a field called status, it is a enum and can be
'optin' or 'optout'.  I need to also show how many there are of each of
those as well.  I have looked at count(a.status) but that just returns the
total numbers listed above, count(DISTINCT a.status='optin') gives me 2 for
some reason.

Suggestions?
-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
http://www.newgeo.com                       Fax: 313.557.5052
[EMAIL PROTECTED]                            Novato, CA U.S.A.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to