Sunday, 7 May 2017

Two *identical* SQL statements behaving differently in PhpMyAdmin vs NodeJS

I'm trying to get the smallest ID (by world) that is not used via this SQL query:

"SELECT MAX(`objects`.`id`) as nextID FROM `objects` WHERE `objects`.`world`='1'"

Previously, I had a more in depth approach that included ids used previously, but it also was having this issue so I've reverted down to this simpler method.

I run this through node and phpmyadmin. When node is doing it, it automatically inserts the world id (and yes I print out the actual query and get that it is identical upon execution). When phpmyadmin executes it returns 14. When node executes its rarely 14 and most of the time null. I have no idea why it would change. All other queries behave normally.



via Quinn Finney

No comments:

Post a Comment