Someone in the past wrote a query to generate data for a report. It's in a SQL Agent job that loads the data into Excel. The group that uses the report is saying they get inaccurate data for a certain section in a certain column. The query utilizes 3 sections (UNION ALL). Let's call the problem section, "section 3."
I can take the query and run it on the production database without errors (red writing) and see the same results the others see in Excel...unless the data changes. The point of Excel is to give a point-in-time look at the data. Since the job runs after the last backup, I should be to restore the backup to another server and troubleshoot but I can't.
When I run the query against the restored database, sections 1 & 2 appear but 3 does not. I can't figure out why. There are derived tables in the query but I still can't figure...