R – Drupal: retrieve data from multiple node types in views 2

drupalviews2

…or, in other words, how to create a simple join as I would do in SQL?

Suppose I want the following information:

Just as an example:

  • a person's full name
  • a person's hobbies.

His full name is in a (content profile) node type 'name_and_address' and his hobbies are in 'hobbies'.

In SQL, I would link them together by node.uid.
I've seen a bit about using relationships, but that goes with user-node-refs.
I just want the same user from one content-type and the other.

Now how could I get his name and his hobbies in 1 view?

Best Answer

There is a how to here does this do the job?

If not...

Views can be extended with custom joins, filters etc. If you are lucky there will be a module for this already. Some modules even provide their own views plugins.

You can write your own views plugins, although the documentation is a little fragmented.

The other thing that should be noted is that views isn't always the answer. Sometimes writing a custom query and display handler will do what you want with much less hassle.

Related Topic