List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:January 24 2006 8:19am
Subject:Re: count(*) send a wrong value
View as plain text  
> Thank you a lot for your answer. I checked very carefully. The structure
> of the table is (exported by phpMyAdmin):
>
> CREATE TABLE `tp_participation` (
>   `uid` int(11) NOT NULL default '0',
>   `challenge_id` int(11) NOT NULL default '0',
>   `response` text collate latin1_general_ci NOT NULL,
>   `points` int(11) default NULL,
>   UNIQUE KEY `tp_id_part` (`uid`,`challenge_id`),
>   KEY `tp_idx_part_solution` (`challenge_id`,`response`(4))
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
>
>
> I removed the key on challenge_id as suggested in another post.
>
> I do the following queries with phpMyAdmin (no direct access to mysql
> client):
>
> select * from tp_participation where challenge_id=20
> > 10 records.
>
> select challenge_id from tp_participation where challenge_id=20
> > _two_ records with the value "20".
>
> select count(challenge_id) from tp_participation where challenge_id=20
> > One record with value "2"
>
> select count(*) from tp_participation where challenge_id=20
> > One record with value "2"
>
> select count(uid) from tp_participation where challenge_id=20
> > One record with value "10"
>
> select count(response) from tp_participation where challenge_id=20
> > One record with value "10"
>
> select count(points) from tp_participation where challenge_id=20
> > One record with value "select count(response) from tp_participation
> where challenge_id=20
> > One record with value "0" (value of points is null for each field with
> challenge_id in the database, so it seems normal)

What are the results if you drop all constraints and indices?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

Thread
count(*) send a wrong valuefabsk23 Jan
  • Re: count(*) send a wrong valuemysql23 Jan
    • Re: count(*) send a wrong valueFabien SK23 Jan
    • Re: count(*) send a wrong valuefabsk23 Jan
    • Re: count(*) send a wrong valueMichael Stassen23 Jan
  • Re: count(*) send a wrong valueRhino23 Jan
    • Re: count(*) send a wrong valuefabsk24 Jan
  • Re: count(*) send a wrong valueHank24 Jan
  • Re: count(*) send a wrong valueMartijn Tonies24 Jan
    • Re: count(*) send a wrong valuefabsk24 Jan
      • Re: count(*) send a wrong valueFabien SK24 Jan
        • Re: count(*) send a wrong valueFabien SK24 Jan