Database custom query just stopped working out of the blue

This might help: