Error 1064 When Select Count (*) In MySQL

This morning at work has come an incidence from development team. I show below the error message;

ERROR 1064 (42000) at line 1: 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 actor’ at line 1

 
This error occurs when you run the following statement;

select count (*) from table1

The problem is the space between “count” and “(*)”. This problem is not new, according MySQL is not an error, but in other databases it works. If execute it without the blank space works, as in this example;

select count(*) from table1

It can be modified to ignore blank as follows;

set @@sql_mode='IGNORE_SPACE';

For more information, please access this link;

Bug MySQL Count (*)

HTH – Antonio NAVARRO

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s