Forum Moderators: open

Message Too Old, No Replies

Count occurances of data in one table which is the same as another tab

         

petrakid

7:12 pm on Apr 13, 2009 (gmt 0)

10+ Year Member



I have two tables.

Table 1, called tbl_maillist_lists, stores the mailing list information (ID, Listname, Desc, Status[Active,Deleted].

Table 2, called tbl_maillist_users, stores the users who may or may not be subscribed to any of the lists (ID, Name, Email, ListID[the ID of the List they are subscribed to], Status[Active,Pending,Deleted,A-Inactive].

What I want to do, if you haven't already guessed, is output the TOTAL number of subscribers for each list, whereas they are ACTIVE users.

Example:


-------------------------------------
¦ Listname ¦ Desc ¦ Subscribers ¦
-------------------------------------
¦ ListA ¦ Fun List ¦ 76 ¦
-------------------------------------

ListA comes from the tbl_maillist_lists table, as does Desc, and Subscribers would be a count of all USERS who are subscribed to ListA, using the ID of the lists table and comparing it to the total count of all users with the same ListID in the users table. It's simple, but unfortunately, all I've been able to output is "Array"...Any help would be appreciated!