Fix queued maintainer sql with missing join causing millions of rows to be generated by a relatively simple sql statement