View to display 2 posts from 1 content type 1 and 2 posts from content type 2 I want to display 4 featured posts on home page. 2 from the content type 1 and 2 from the content type 2. For this the straight forward way is to create two different views blocks. What I want to know if it is possible to display all 4 posts through a single view ??
I have a multipart part answer to this question:


No, there's no way to do show exactly two nodes of one content type and two of another type using only 1 view if you want them grouped in a specific order.
If you don't care about that nodes of different content types are mixed up together, you can change your content-type filter to include multiple content types. This only uses one view but may not be exactly what you want.
If you give up on using only 1 view, Kojo's comment lays out an excellent and quick way to embed views inside of another view to create the desired effect. Just to recap: create one view for each content type, and put one of the views in the header of the other view. This gives the desired effect, but gives up on using only 1 view.
You could use a SQL query like this to create a custom theme hook that would have the intended effect without using Views at all. It would require SQL knowledge to maintain it, but it would also have a lot less overhead. Here's what you'd need to do:


Inside template.php in your theme:

&lt;?php
/**
 * Implements hook_theme().
 *
 * This registers a custom function for use with the theme() function.
 * To make your featured nodes show up in a template, add this code:
 *
 *   print theme('featured_nodes');
 *
 * Whenever theme() is called with that argument, a certain preprocess function
 * will be called. I like to write SQL in those preprocess functions to 
 * find raw data from the database. Then a template will be used to display 
 * the information looked up in the preprocess function. Finally, the template
 * is returned as a string wherever theme() was originally called.
 *
 * Look up hook_theme in the API docs at http://api.drupal.org/ for more info.
 */
function mytheme_theme() {
    return array(
        'features_nodes'] = array(
            // Here I define which template should be used. 
            // In this case, the template will be called featured-nodes.tpl.php
            'template' =&gt; 'featured-nodes',
        )
    );
}

/**
 * Implements hook_preprocess_hook().
 *
 * This function is triggered before the template is rendered. You can
 * pass variables into the template simply by adding them to $vars.
 */
function mytheme_preprocess_features_nodes(&amp;$vars) {
    // This is a really simple query that looks up all the fields
    // on the node table for the 2 most recent nodes of type 1,
    // then it adds all the fields of the 2 most recent nodes of type 2.
    // Learning SQL is bigger than the scope of this question.
    $results = db_query('
        SELECT *
          FROM {node}
         WHERE type = "machine_name_of_content_type_1"
         LIMIT 2
      ORDER BY created DESC
         UNION
        SELECT *
          FROM {node}
         WHERE type = "machine_name_of_content_type_2"
      ORDER BY created DESC
         LIMIT 2
    ');
    $featured_nodes = array();

    // We use db_fetch_object() repeatedly to read out each result row.
    while ($row = db_fetch_object($result)) {
        $featured_nodes[] = $row;
    }

    // Anything in $vars will be added to the templates when they are rendered.
    $vars['featured_nodes'] = $featured_nodes;
} 


Then, inside featured-nodes.tpl you'll have access the $featured_nodes variable and you can display some very basic information about the nodes that you want (nid, title, author, and created date).

Here's an example of what should go inside featured-nodes.tpl.php:

&lt;ul class="featured-nodes"&gt;
    &lt;?php foreach ($featured_nodes as $node) : ?&gt;
    &lt;li&gt;&lt;?php print l($node-&gt;title, "node/{$node-&gt;nid}"); ?&gt;&lt;/li&gt;
    &lt;?php endforeach; ?&gt;
&lt;/ul&gt;


NOTE: None of the above code is tested and it may require some tweaking.

Here's an in-depth blog post I wrote with more information on how and why to do version 4.