Core/Database: Fix bad sql query in 1da6b2f81b975d3deaf476de16d4240e442da4cb