David, Remove the space between COUNT and (*). SELECT COUNT(*) ... will work, but SELECT COUNT (*) ... will give you the syntax error.
Andy > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of David Krings > Sent: Sunday, March 30, 2008 9:50 PM > To: MySQL SIG > Subject: [mysql] MySQL Count > > Hi! > > I want to count all the rows in a table. The table is called book and is > stored in the database books and the column isbn is the primary key. Based on > what everyone on the database claims, this should be the query that returns > the amount of rows in the table book: > SELECT COUNT (isbn) FROM books.book; > > But when executing this the MySQL Query Browser gives me the error message > "No > database selected!". I also tried > SELECT COUNT (*) FROM books.book; > but that gives me a syntax error at "*)...". > > I tried several other variations that also did not generate any results. I do > not execute any other queries across the entire table before and I don't > really want to send some dummy SELECT * statement just to count the affected > rows. > > Any idea what MySQL has against using COUNT? > > David > _______________________________________________ > New York PHP Community MySQL SIG > http://lists.nyphp.org/mailman/listinfo/mysql > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community MySQL SIG http://lists.nyphp.org/mailman/listinfo/mysql NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php
