views:

119

answers:

1

I have a Person content type. It has a node reference field of a company which is also a content type. I then have a content type called Project. A project has a node reference to a company content type. I want to list all the projects related to a person id (nid)

If I abstract this away from views and Drupal and each content type had it's own table I would use something like.

Select ProjectName from Projects where CompanyID IN (select CompanyID from Perons where PersonID = 10)

Can I do something similar in Views?

My PersonID would be an argument. This would bring back the person content type. I would then use a relationship to bring back the company.

I now don't know know how to link the company up to the project...

+1  A: 

It may not be the answer you are looking for, but I typically will do one of two things for the double relationship thing.

  1. Skip views altogether and do a custom query.

  2. Create a view for the first relationship. Inside the view templates for this, I will

2a. Just do a node_load() to pull in the nodes for second relationship.

2b. Manually instantiate another view (either via views_embed_view() or views_get_view_result()) passing in the proper argument.

MPD
I will give number 2 a try and let you know how I get on...
Linda
Follow up questions here: http://stackoverflow.com/questions/3727201/drupal-performing-a-query-against-the-database this is when trying to do option 1.
Linda

related questions