What is the difference between these two as implemented on hook_views_data_alter()? Why choose one over the other?

I did notice that in setting up a relationship between mytable1 and users tables, the Views UI gave me the option to add the mytable1.uid field under the relationship section, that way allows me to add users fields into the query.

What am I supposed to notice on the views-UI when I implement a join on a table? My implementation is as follows:


    $data['mytable1']['table']['join']['users'] = array(
        'left_field' => 'uid',
        'field' => 'uid',


I did this without a relationship setting, so I can observe the exclusive effect of each(join vs relationship)

1 Answer 1


From my experience, a join is always done when the query is executed. This means that you can utilise the fields on the joined tables without adding a relationship in the view. When a join is used, I don't think the views information tied to that table is pulled in. For example, you won't be able to add relationships tied to that table.

A relationship is a choice that the user can make on the view. They can choose to add the relationship (from the section on the right side of the view). When a relationship is added, the views information tied to that entity is also pulled in. For example, you will be able to add relationships linked to that table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.