Get the actual query executed by a view
You have to use hook_views_pre_execute and with Devel installed use dpq to view the SQL String:

function hook_views_pre_execute(&amp;$view) {
  dpq($view-&gt;build_info['query']);
}