I need to do some debugging and want to see what the SQL query generated by a view looks like. Can somebody tell me in which function these SQL queries are generated and how I can print them out so I can see?

Thanks.

Comments

Anonymous’s picture

you can see the query through the Views interface.

Navigate to: admin/build/views/tools/basic and turn on "Show query above live preview" then go back to the edit page for your view and click on 'Preview'. Views will now show you the preview and the query or queries used to create it.

gladiator’s picture

However, the preview doesn't seem to work I think because there is an argument in that view and probably I have to provide the argument value? Do you know what is the format I need to follow to provide argument?