How to join tables with hook_views_data I have two tables activity and activity_map. I need to join both the tables by aid. Below is my code for hook_views_data. Base table is working fine including custom text handler. But I do not see the joined table(activity_map) fields (entity_id, entity_type)  either in fields section nor in arguments or filters. Am I missing anything?

  &lt;?php

    /**
 * Implements hook_views_data
 */
function activity_teamie_views_data() {
  $data['activity_teamie']['table']['group'] = t('Activity');
  $data['activity_teamie']['table']['base'] = array(
    'title' =&gt; t('Activity'),
    'field' =&gt; 'aid',
    'help' =&gt; t('Activity feed item')
  );
  $data['activity_teamie']['aid'] = array(
    'title' =&gt; t('Activity ID (aid)'),
    'help' =&gt; t('Activity ID'),
    'field' =&gt; array(
      'handler' =&gt; 'views_handler_field',
      'click sortable' =&gt; TRUE
    ),
    'argument' =&gt; array(
      'handler' =&gt; 'views_handler_argument_numeric'
    ),
    'filter' =&gt; array(
      'handler' =&gt; 'views_handler_filter_numeric'
    ),
    'sort' =&gt; array(
      'handler' =&gt; 'views_handler_sort'
    )
  );
  $data['activity_teamie']['template'] = array(
      'real field' =&gt; 'template',
      'title' =&gt; 'Activity',
      'help' =&gt; 'Text describing the activity',
      'field' =&gt; array(
        'handler' =&gt; 'activity_teamie_handler_field_activity_text',
      ),

  );
  $data['activity_teamie']['data'] = array(
    'title' =&gt; 'Data',
    'help' =&gt; 'Data array',
    'field' =&gt; array(
      'handler' =&gt; 'views_handler_field',
    ),
  );
  $data['activity_teamie']['created'] = array(
    'title' =&gt; t('Created'),
    'help' =&gt; t('Created timestamp'),
    'sort' =&gt; array(
      'handler' =&gt; 'views_handler_sort_date'
    )
  );
  $data['activity_teamie']['updated'] = array(
    'title' =&gt; t('Updated'),
    'help' =&gt; t('Updated timestamp'),
    'field' =&gt; array(
      'handler' =&gt; 'views_handler_field_date',
    ),
    'sort' =&gt; array(
      'handler' =&gt; 'views_handler_sort_date'
    )
  );

  /* ACTIVITY MAP */
  $data['activity_teamie_map']['table']['group'] = t('Activity');

  // Join with the {activity} table
  $data['activity_teamie']['table']['join'] = array(
    'activity_teamie_map' =&gt; array(
      'left_field' =&gt; 'aid',
      'field' =&gt; 'aid'
    )
  );
  $data['activity_teamie_map']['aid'] = array(
      'title' =&gt; t('Aid Map'),
      'help' =&gt; t('Aid Map'),
    'field' =&gt; array(
          'handler' =&gt; 'views_handler_field',
  ),
      'filter' =&gt; array(
        'handler' =&gt; 'views_handler_filter_numeric'
  ),
      'argument' =&gt; array(
        'handler' =&gt; 'views_handler_argument_numeric'
  )
  );
  $data['activity_teamie']['entity_type'] = array(
    'title' =&gt; t('Entity type'),
    'help' =&gt; t('Entity type of the associated entity'),
  'field' =&gt; array(
        'handler' =&gt; 'views_handler_field',
  ),
    'filter' =&gt; array(
      'handler' =&gt; 'views_handler_filter_string'
    ),
    'argument' =&gt; array(
      'handler' =&gt; 'views_handler_argument_string'
    )
  );
  $data['activity_teamie']['entity_id'] = array(
    'title' =&gt; t('Entity ID'),
    'help' =&gt; t('Entity ID of the associated entity'),
  'field' =&gt; array(
        'handler' =&gt; 'views_handler_field',
  ),
    'argument' =&gt; array(
      'handler' =&gt; 'views_handler_argument_numeric'
    )
  );
  return $data;
}
$data['activity_teamie']['table']['join'] = array(
  'activity_teamie_map' =&gt; array(
    'left_field' =&gt; 'aid',
    'field' =&gt; 'aid'
  )
);


You actually want to join the other way round.kk

A general tip, try to think of some kind of similar join relation in Drupal core and look it up in views/modules/$module.views.inc

$data['activity_teamie']['entity_id'] = array(


Isn't entity_id part of activity_teamie_map?