hook_views_data : join table node twice I try to configure a custom table in hook_views_data. I need to join the same table (node) twice.
The problem is that i can't have the same key for 2 entries in my array :

$data['maz_composition']['table']['join'] = array(
    // Index this array by the table name to which this table refers.
    // 'left_field' is the primary key in the referenced table.
    // 'field' is the foreign key in this table.
    'node' =&gt; array(
        'left_field' =&gt; 'nid',
        'field' =&gt; 'aid',
    ),
);


Is there a solution for that ?
Thanx and sorry for my bad english.
I know it is a bit late. But I had the same problem and ran into this page. So here is how I solved it. It is with my own case, but solution is generic, I hope it will help someone.

I join wootoon_cached_sets twice, the key in $data['whatever'] is only the alias in the query. The actual table is given by the table property. This is confusing because if ignored, this property defaults to the table key.

I end up With the following query:

LEFT JOIN {wowtoon_cached_sets} wowtoon_cached_sets_main 
ON   wowtoon_owners.toon_key = wowtoon_cached_sets_main.toon_key 
AND  wowtoon_cached_sets_main.active = '1' 
LEFT JOIN {wowtoon_cached_sets} wowtoon_cached_sets_second 
ON   wowtoon_owners.toon_key = wowtoon_cached_sets_second.toon_key 
AND  wowtoon_cached_sets_second.active = '0'


Using the below code:

  $data['wowtoon_cached_sets_main']['table']['group']  = $data['avatar']['table']['group'];
  $data['wowtoon_cached_sets_main']['table']['join'] = array(
      'avatar' =&gt; array(
        'left_table' =&gt; 'wowtoon_owners',
        'left_field' =&gt; 'toon_key',
        'field' =&gt; 'toon_key',
        'table' =&gt; 'wowtoon_cached_sets',
        'extra'      =&gt; array(
          array(
            'field'    =&gt; 'active',
            'value'    =&gt; 1,
          ),
        )
    )
  );

  $data['wowtoon_cached_sets_second']['table']['group']  = "second spec";
  $data['wowtoon_cached_sets_second']['table']['join'] = array(
      'avatar' =&gt; array(
        'left_table' =&gt; 'wowtoon_owners',
        'left_field' =&gt; 'toon_key',
        'field' =&gt; 'toon_key',
        'table' =&gt; 'wowtoon_cached_sets',
        'extra'      =&gt; array(
          array(
            'field'    =&gt; 'active',
            'value'    =&gt; 0,
          ),
        )
    )
  );

  $data['wowtoon_cached_sets_main']['spec'] = array(
          'field' =&gt; array(
            'field' =&gt; 'spec',
            'title' =&gt; t('Spec'),
            'click sortable' =&gt; TRUE,
            'help' =&gt; t('wowtoon_cached_sets Spec'),
            'handler' =&gt; 'views_handler_field',
    ),
  );
  $data['wowtoon_cached_sets_second']['spec'] = array(
          'field' =&gt; array(
            'field' =&gt; 'spec',
            'title' =&gt; t('Spec 2'),
            'click sortable' =&gt; TRUE,
            'help' =&gt; t('wowtoon_cached_sets Spec 2'),
            'handler' =&gt; 'views_handler_field',
    ),
  );