Stefano Perna wrote:
> 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!!
>
>
as strawberry would tell you: if you add and "order by" clause at the
end of your statement, it'll order it for you. for example:
select blah blah
from blah
group by bla
order by cat_id
--
lark --
hamzee@sbcdeglobalspam.net
To reply to me directly, delete "despam".