[ENG] select count question

[ENG] select count question

am 23.01.2006 16:15:17 von Bob Bedford

I've a table where I store the search done in our database.

table searchlog:
type - make - price

Now I've been able to find all kinf og type search:

- shoes
- pants
- swimming stuffs....

Now, I'd like, for exemple for the shoes, count how many have been choosen
for every make.

- shoes
-adidas
-nike
-puma

and for them count how many have been done.

So I'd like to select count(make) from searchlog where type=shoes.

How to do so ? Doing a simple count count the total of the shoes, not the
total for every make.
Please help.

Bob

Re: [ENG] select count question

am 23.01.2006 16:34:04 von Dominik Echterbruch

Bob Bedford wrote:
>
> Now, I'd like, for exemple for the shoes, count how many have been choosen
> for every make.
>
> - shoes
> -adidas
> -nike
> -puma
>
> and for them count how many have been done.
>
> So I'd like to select count(make) from searchlog where type=shoes.
>
> How to do so ? Doing a simple count count the total of the shoes, not the
> total for every make.

You are looking for GROUP BY. [1] will surely help you.

[1] http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.ht ml


Grüße,
Dominik
--
MonstersGame - Die Schlacht zwischen Vampiren und Werwölfen
http://spielwelt6.monstersgame.net/?ac=vid&vid=3018786

Re: [ENG] select count question

am 23.01.2006 17:50:46 von Bob Bedford

"Dominik Echterbruch" a écrit dans le message de
news: 1138030444.15972.0@ersa.uk.clara.net...
> Bob Bedford wrote:
>>
>> Now, I'd like, for exemple for the shoes, count how many have been
>> choosen for every make.
>>
>> - shoes
>> -adidas
>> -nike
>> -puma
>>
>> and for them count how many have been done.
>>
>> So I'd like to select count(make) from searchlog where type=shoes.
>>
>> How to do so ? Doing a simple count count the total of the shoes, not the
>> total for every make.
>
> You are looking for GROUP BY. [1] will surely help you.
>
> [1] http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.ht ml
Hi Dominik

thanks for the info, but the totals are quite strange....
I've a left join to link tables and I've totals that seems to sum at each
new record.

Re: [ENG] select count question

am 25.01.2006 10:26:28 von Christian Kirsch

Bob Bedford schrieb:
> "Dominik Echterbruch" a écrit dans le message de
> news: 1138030444.15972.0@ersa.uk.clara.net...
>> Bob Bedford wrote:
>>> Now, I'd like, for exemple for the shoes, count how many have been
>>> choosen for every make.
>>>
>>> - shoes
>>> -adidas
>>> -nike
>>> -puma
>>>
>>> and for them count how many have been done.
>>>
>>> So I'd like to select count(make) from searchlog where type=shoes.
>>>
>>> How to do so ? Doing a simple count count the total of the shoes, not the
>>> total for every make.
>> You are looking for GROUP BY. [1] will surely help you.
>>
>> [1] http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.ht ml
> Hi Dominik
>
> thanks for the info, but the totals are quite strange....
> I've a left join to link tables and I've totals that seems to sum at each
> new record.
>

OT: You're posting in a german speaking newsgroup here. If people are
responding, it's because they make an extra effort for *you*. On the
other hand, it would be polite if you made at least a minimal effort
to explain *your* problem. Post *code*, not prosa. Post *results*, not
your interpretation of them - nobody but you has any idea of 'quite
strange'. Post the *desired* results. *Show* us, what you're doing.

Re: [ENG] select count question

am 25.01.2006 17:36:51 von Bob Bedford

"Christian Kirsch" a écrit dans le message de news:
dr7g8v$stc$1@news.mind.de...
> Bob Bedford schrieb:
>> "Dominik Echterbruch" a écrit dans le message de
>> news: 1138030444.15972.0@ersa.uk.clara.net...
>>> Bob Bedford wrote:
>>>> Now, I'd like, for exemple for the shoes, count how many have been
>>>> choosen for every make.
>>>>
>>>> - shoes
>>>> -adidas
>>>> -nike
>>>> -puma
>>>>
>>>> and for them count how many have been done.
>>>>
>>>> So I'd like to select count(make) from searchlog where type=shoes.
>>>>
>>>> How to do so ? Doing a simple count count the total of the shoes, not
>>>> the
>>>> total for every make.
>>> You are looking for GROUP BY. [1] will surely help you.
>>>
>>> [1] http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.ht ml
>> Hi Dominik
>>
>> thanks for the info, but the totals are quite strange....
>> I've a left join to link tables and I've totals that seems to sum at each
>> new record.
>>
>
> OT: You're posting in a german speaking newsgroup here. If people are
> responding, it's because they make an extra effort for *you*. On the
> other hand, it would be polite if you made at least a minimal effort
> to explain *your* problem. Post *code*, not prosa. Post *results*, not
> your interpretation of them - nobody but you has any idea of 'quite
> strange'. Post the *desired* results. *Show* us, what you're doing.

You are right, I'll certainly try to explain better the next time. Finally I
did found the answer somewhere else.

Bob