View Single Post

   
  #5 (permalink)  
Old 02-28-2008, 09:46 AM
Stefano Perna
 
Posts: n/a
Default Re: how many of a kind

strawberry ha scritto:

>
> Like me, Mysql is inherently lazy. You can pretty much assume that it
> doesn't do anything unless specifically asked - but sometimes you get
> lucky.
>




uhm... this makes me think this apparently useful idea is useless...
That is: I need a precise sequence. In practice, I've two tables, one
containing categories

categories

cat_id | cat_type
1 | Washers
2 | Dryers
3 | Phones
4 | Radios

the other one is the one I posted in a previous post

products

product_name | cat_id

prod1 | 1
prod2 | 2
prod3 | 2
prod4 | 2
prod5 | 3
prod6 | 3
prod7 | 4

Using PHP, I must serve to the client a menu like this one:

Washers(3)
Dryers(5)
Phones(2)
Radios(1)

(there's something similar on E-Bay)

So, this is my goal:
is there something MySQL can do for me or I must (over)use PHP with
multiple queries?

Thanks!!


Reply With Quote