Equi Join
The Equi Join module allows you to create relationships between different entities based on an arbitrary field. This allows the use of relationships in Views without having to add Node References to a content type, which may not be an option when displaying data stored on a third-party database or data provided through custom Views handlers. That said, it works with nodes as well.
As an example, if you have a content type Employee and another content type Department, and they both have a different field that contains their Department ID, you can create a View that links them both by means of the Department ID field. In very simplified terms, the resulting query would be something like (note that the fields for the ON clause can be different as long as they contain similar data to join on):
SELECT *
FROM employee
LEFT JOIN department
ON employee.field_employee_deptid = department.field_department_id;
The above query will retrieve all the employees with their associated departments.
Read more about equi-joins here: http://en.wikipedia.org/wiki/Join_(SQL)#Equi-join
Requirements
This module depends on Views.
How to use
This module has no configuration outside of Views. To use, create your view and add a Relationship. There will be a group for Equi Joins - select the appropriate relationship type. In the Equi Join configuration pop-up, select the right and left fields that will be used for the join. For the example above, you would select field_employee_deptid
for the left field, and field_department_id
for the right field. The relationship can now be used on Views elements to retrieve the Department information for the displayed Employees.
Future development
Planned features for this module are:
- Better support for Natural Joins
- Create relationships outside of a View
Credits
- Developed by Victor Kareh (vkareh)
- Sponsored by University of Michigan
- Code heavily based on the Views Cross Join module by hunziker