Hello all Maybe it's been a long week, but I'm trying to do something that should be simple and just not getting anywhere.
I have two tables: accounts acctid: int unique acctowner: char ... docs docid: int unique acctid: int doctitle: char ... I want to list my accounts along with a count of the documents associated with each account. I tried a simple GROUP BY: SELECT a.acctid, a.acctowner, COUNT(d.acctid) FROM accounts AS a, documents AS d WHERE a.acctid = d.acctid GROUP BY a.acctid; This almost works, but I don't get any of the accounts that don't have any associated documents. I want all accounts listed, even if COUNT(documents) is 0. Would this work better as a subquery? I'll admit that I'm still stumbling when it comes to subqueries. Any help would be greatly appreciated. /dwight -- Dwight N. Tovey [EMAIL PROTECTED] http://www.dtovey.net/~dwight/ Please Do Not send me Microsoft Word attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ----------- Higher education helps your earning capacity. Ask any college professor. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]