correct broken queryDB() sql