Good point - oops, I didn't spot that, chuckle!
If you remove your query statement - does it produce a view correctly, using the rest of the code as it stands?
If you remove your query statement - does it produce a view correctly, using the rest of the code as it stands?