Re: [PHP-DB] a Count() ?

2002-03-16 Thread DL Neil
is correct, then where is the linkage between the two SELECTs, and why not do the whole job in one joined SELECT? Please advise, =dn - Original Message - From: "Dave Carrera" <[EMAIL PROTECTED]> To: "'DL Neil'" <[EMAIL PROTECTED]> Sent: 16 March 2002

Re: [PHP-DB] a Count() ?

2002-03-16 Thread Pierre-Alain Joye
On Sat, 16 Mar 2002 11:50:11 - "DL Neil" <[EMAIL PROTECTED]> wrote: > Hi Dave, > SELECT * FROM tblNm; > SELECT * FROM tblNm GROUP BY Catid1; > SELECT Catid1, count(*) FROM tblNm GROUP BY Catid1; > > As I said 'follow your instincts' and take it one step at a time: Code > the simplest quer

Re: [PHP-DB] a Count() ?

2002-03-16 Thread Pierre-Alain Joye
On Sat, 16 Mar 2002 10:46:38 - "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

Re: [PHP-DB] a Count() ?

2002-03-16 Thread DL Neil
;error: > ".mysql_error()); > $cntcat = mysql_fetch_array($cntresult,1,catcnt) ;{ > for($n =0; $n < count($cntcat); $n++){ > $showitemcount = each($cntcat); > > Dave Carrera > Php Developer > http://davecarrera.freelancers.net > http://www.davecarrera.com > > > -

Re: [PHP-DB] a Count() ?

2002-03-16 Thread DL Neil
Hi Dave, > 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

Re: [PHP-DB] a Count() ?

2002-03-16 Thread Andrey Hristov
select cat_id, count(prod_id) from some_table order by cat_id; Best regards, Andrey Hristov - Original Message - From: "Dave Carrera" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, March 16, 2002 12:46 PM Subject: [PHP-DB] a Count() ? > Hi All &

[PHP-DB] a Count() ?

2002-03-16 Thread Dave Carrera
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 i