I have a views question. (Drupal 7 Views 3) I would like to do what I think is called a union. I have a user profile (profile 2) called students that has fields like last name, age, address, e-mail, teacher. I have a content type called schools that has fields like name, address, e-mail, principal. (this architecture of having the students as a profile and the schools as a content type is out of my control and was set up by others) I would like the results to list the students name and the name of the school in the same column., is this doable in views or do I need a module
My attempt at a simplified sql query (I am not sure how Drupal creates tables for content types and profiles so I hope you get the idea)
(SELECT student_table.student_name, teacher_table.teacher_name
FROM student_table LEFT JOIN teacher_table
WHERE student_table.teacherID = teacher_table.teacherID)
UNION
(SELECT school_table.school.name, principal_table.principal_name
FROM school_table LEFT JOIN principal_table
WHERE school_table.principal ID = principal_table.principalID);
The simplified hoped for result:
Bob Brown Mr. Green
Cindy Brown Ms. White
John Brown Ms. Blue
Brown High School Principal Pink
Brown Middle School Principal Red