When you build a drupal website, the views module is your great friend. It will help you build lists of content (eg. the 5 latest blog posts). Sometimes though you would love to learn what query is the view running exactly. This may be for debugging or a different reason. Here is how to get it in code.
Below you have instruction how to display full SQL query in Views module in Drupal.
- Download and enable Devel module
- Open file views/plugins/views_plugin_query_default.inc
- In class views_plugin_query_default find method query($get_count = FALSE)
- In method query() before return add line: dpq($query);
How it looks on website: