Fixed error in db query syntax