Re: Combining results - is there better way?
| From: | Miles Thompson | Date: | Fri, 16 Jan 2004 15:57:48 +0000 |
| Subject: | Re: Combining results - is there better way? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174835@lists.php.net to get a copy of this message | ||
John,
Perfect. Don't know where my head was.
Miles
At 10:29 AM 1/16/2004 -0500, John W. Holmes wrote:
Miles Thompson wrote:<snip> } // foreach My question is if there is a faster, cleaner way to do this? I did try array_search, but as it looks for any matching value anywhere in the target array the results it returned were not reliable.If I'm understanding you correctly, I think this'll work: SELECT c.nClassKey, c.Classification, COUNT(s.nClassKey) FROM classifications c LEFT JOIN subscribers s ON c.nClassKey = s.nClassKey GROUP BY c.nClassKey -- ---John Holmes...