Fixed #22429 -- Incorrect SQL when using ~Q and F