get same result from db_query() as views query I know I can get a views result programatically with:

$view = views_get_view('view_name');
$view-&gt;execute();
$response1 = $view-&gt;result;


I can get this views sql query from the views ui (views->settings->show sql).  If I place this query in a db_query() and get the results with:

$query = "... "; //long sql query from views ui (in my case with left_joins which reference field collections
$result = db_query($query);
$response2 = $result-&gt;fetchAll();  //different than $response1 above?


the responses returned from $response1 (from views) and $response2 (from db_query) are different, namely, the $response2 doesn't contain my field data (or at least not all of it).  I'm not sure if this has anything to do with the fact that I'm using field collections.  It also seems to not work when using the different fetch() functions.   If I run this query through phpmyadmin it produces the same limited results as $response2 (from db_query) so I'm wondering if views runs something aside from the query.  I'd like to find out what the method result() does for the views object, but I'm not sure where that is in the docs or where the function is in my views source.  If someone can show me where that is, that would also be helpful.
Your view most likely has tags getting attached to it, like node_access. Or if you're using grouping on the View that may make a difference in the result property.

Like Nikhil suggested to add that hook somewhere in a custom module just to see what $query has in it. And if you have the Devel module installed you can pass that query like so:

dpq($query);


If it ends up being the case that you have tags being added to the views query and need to mimic that, I'd recommend switching over to the dynamic queries and doing an $query-&gt;addTag(...);