I'm brand new to Java and to MySQL too. On the tutorials I've been watching I've followed step by step but the tutorial itself is a bit outdated, and when I enter the below code I get an error stating that the syntax is not correct.
Here's the code
Here's the error:
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 '*) as count from minion where id=2' at line 1
Anyone able to help with this?
Thanks a lot - this is ALSO the first time I've ever logged into or used a forum, so I sincerely apologise if I'm using it wrong. Just let me know.
Stephen Pillinger wrote:Should have paid more attention to the syntax itself, that's exactly what it was (putting a space after 'count').
I've been writing SQL for a very long time and I didn't know about that rule. And even the MySQL documentation about counting rows doesn't mention that you aren't allowed to put whitespace between "count" and "(".
But then, as I said, I never tried putting that whitespace in there. It's just not something I would ever find necessary; maybe that's because none of the examples in the documentation include that whitespace.
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java