mysql - How to get only one of the rows that are different? -


i'm making newsletter php module has queue list (so cron file can send specific number of emails minute), , wan't show in backoffice if newsletter has emails on queue , how many, save processing time, don't wan't each newsletter , go field field if has emails send.

so, imagine structure in newsletter_queue table:

newsletter_id   email 1           test1@hotmail.com 1           test2@hotmail.com 1           test3@hotmail.com 1           test4@hotmail.com 2           test2@hotmail.com 2           test3@hotmail.com 2           test4@hotmail.com 3           test4@hotmail.com 

i wan't values:

newsletter_id   count(email) 1               4 2               3 3               1 

so, query newsletter newsletter , check if sends pending , count, wan't save processing time.

select newsletter_id, count(email) newsletter_queue  group newsletter_id 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -