On Sat, 16 Mar 2002 10:46:38 -0000 "Dave Carrera" <[EMAIL PROTECTED]> wrote:
> Hi All > > I am trying to count how many product names in my db have the same > category id and then show it ie: > > Catid 1 Product 1 > Catid 1 Product 2 > Catid 2 Product 3 > Catid 3 Product 4 > Catid 3 Product 5 > > Result would be > > Catid1 has 2 products > Catid2 has 1 products > Catid3 has 2 products > > I think it has something to do with the GROUP command but the mysql doc > dose not make it clear how to achive this task. > > Code examples, pointers to web resources or any info thankfully > received. Simply by a sql query : SELECT count( Catid ) as total, Catid FROM t_product GROUP BY Catid; the result set will be something like that total____CatID 2________1 1________2 2________3 hth pa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php