Hi G,
   There is nothing weird about your results. When you do a Count(*)
without a GROUP BY(someColumn) you are essentially asking MySQL how
many rows are present in the table. But when you do use Group By
someColum , you are asking MySql how many  rows do I have of
"someColumn" .  It's just a good practice to use GROUP BY when you
want to a count of a specific column .

mysql> select count(*) as 'Count' from logins GROUP BY dawiz

The above query should return the results you are looking for.



On Tue, Sep 9, 2008 at 6:06 PM, MySql <[EMAIL PROTECTED]> wrote:
> We are running MySql version 5.0.45-Debian_1ubuntu3.1-log Debian etch 
> distribution under Ubuntu.
> If I submit the following query via mysql_query it acts as if the where is 
> not there:
>
> select count(*) as 'Count' from logins where player = 'aqwert';
>
> this returns:
>     Count
> 143578160
>
>
> Submitting the same query at a MySql prompt works correcty:
>
> mysql> select count(*) as 'Count' from logins where player = 'dawiz';
> +-------+
> | Count |
> +-------+
> |  6026 |
> +-------+
> 1 row in set (0.00 sec)
>
> Modifying the query to use a group by returns the correct count:
>
>    Total    Count
>    Total     6026
>
> Is there something I should know about mysql_query and a simple count(*)?
>
> G Vaughn
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to