I have now managed to get the SQL working and it works perfectly! Something as simple as a typo was preventing it from working.However as people have suggested using a query on the system table or creating a reports table is probably a better approach.
Thanks all for your help