[PHP-DB] Re: Query construction

2001-08-22 Thread Michael Kumar
dang, messed up the order of statements, sorry. of course it must read: select count(*) from posts where category = 'foobar' group by category regards, mike. -- mfG, Michael Kumar (michael.kumar_at_nme.at, m.kumar_at_hushmail.com) PGP: 30FE 3AB9 5077 C554 5D9E B5CC 0B0F CFB2 55D6 AA75 .: kno

[PHP-DB] Re: Query construction

2001-08-22 Thread Michael Kumar
select count(*), category from posts group by category or select count(*) from posts group by category where category = 'foobar' should do the trick. regards, mike. -- mfG, Michael Kumar (michael.kumar_at_nme.at, m.kumar_at_hushmail.com) PGP: 30FE 3AB9 5077 C554 5D9E B5CC 0B0F CFB2 55D6 AA75

[PHP-DB] Re: Query construction

2001-08-21 Thread Russ Michell
Steve: I tried your method which is pretty much what I was trying already, but got the following error message: MySQL Error Info 1064: You have an error in your SQL syntax near 'distinct(category)) AS total FROM posts' at line 1 I am using MySQL 3.22.32 (Quite an oldish version - not sure if

[PHP-DB] Re: Query construction

2001-08-21 Thread Steve Brett
select count(distinct(category)) as number_of_posts from posts; should do it. Steve "Russ Michell" <[EMAIL PROTECTED]> wrote in message news:SIMEON.10108211219.F@k1c. anglia.ac.uk... > Hi there people: > > I have a MySQL table consisting of category names among other things. > I would like to b