List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 18 2002 10:41pm
Subject:Re: count function issue
View as plain text  
At 17:26 -0500 9/18/02, McIrvin wrote:
>OK,, I'll clarify:
>
>A query like:
>SELECT terms, count(*) AS count FROM searches GROUP BY terms HAVING
>count(*)>1 ORDER BY count DESC
>
>Is run on a table built by users searches on a site, so there are lots of
>duplicate entries, were trying to count the duplicates to determine the most
>popular search terms.
>
>The problem arises where you do a query like
>
>SELECT * FROM 'terms' WHERE term='test'
>
>And count the number of rows returned (with php or whatever) the issue is
>that the result from the count() function ends up being a little higher
>sometimes but by no more than 3 instances.

What happens if you replace count(*) by count(terms) throughout the
query?



>
>--=C
>
>
>----- Original Message -----
>From: "Paul DuBois" <paul@stripped>
>To: "McIrvin" <mcirvin@stripped>; <mysql@stripped>
>Sent: Wednesday, September 18, 2002 5:06 PM
>Subject: Re: count function issue
>
>
>>  At 16:50 -0500 9/18/02, McIrvin wrote:
>>  >Doing queries to determine the number of times search terms are used on a
>>  >web site.
>>  >
>>  >Here is a sample sql query.
>>  >
>>  >SELECT terms, count(*) AS count FROM searches GROUP BY terms HAVING
>>  >count(*)>1 ORDER BY count DESC
>>  >
>>  >But the results seem to be inaccurate, by no more that 3.
>>
>>  Sorry, it's difficult to parse that last sentence.
>>
>>  Also, since you don't indicate what you expect and what you actually
>>  got, it's hard to say whether what you're seeing is to be expected.
>>
>>  >
>  > >Anyone run into anything like this before?

Thread
count function issueMcIrvin19 Sep
  • Re: count function issuePaul DuBois19 Sep
  • Re: count function issueMcIrvin19 Sep
    • Re: count function issuePaul DuBois19 Sep
  • Re: count function issueMcIrvin19 Sep
  • Re: count function issueMcIrvin19 Sep
    • re: Re: count function issueEgor Egorov19 Sep