This article has not been rated yet. After reading, feel free to leave comments and rate it.
You may be surprised to find out that there is no white space allowed between count and () in mysql queries.
Also be careful on which column you perform the count. It may not be wise to use count(*) if you have a certain index defined and you have a where condition that uses this index. You might want to replace the '*' with a column name. Read more on this bug here:
http://bugs.mysql.com/bug.php?id=14980
// ERROR 1064 (42000): You have an error in your SQL syntax;
// check the manual that corresponds to your MySQL server version for the right
// syntax to use near '(*) from table1' at line 1
select count (*) from table1;
// the next one works:
select count(*) from table1;
Send a message to
Subject
Comments:
2010-01-12, 08:38:43
anonymous from Indonesia
Wow.. thanks a lot..
i'm confused when my query select count (*) is not working...
i waste time for that.
thanks a milion :) :) :)