1

I'm using Drupal 7. I have created two content types (A & B); content type B is referenced from content type A.
I want to create a view, I need to filter the nodes of content type B by showing the last node only (by date), for every node from content type A.

How can I achieve this?

3
  • so you want to have a listing, where As will be standing beside last referenced Bs ? (something like a last comment ?)
    – mojzis
    Apr 2 '12 at 19:50
  • yes, i want to display a table which every row contain the last node b for every referenced node from a. like this node 1(last date) for node a1 node 2(last date) for node a2 ... Apr 2 '12 at 20:15
  • quite hard to acheive i think. i'd probably suggest adding a computed field on A, that would store the reference to the last B and would be set upon saving the last B.
    – mojzis
    Apr 2 '12 at 21:15
1

You need to create a relationship in Views. Then filter by creation date descending, and limit results to 1. 'Relationship' is how Views does a SQL JOIN.

It's non-trivial to describe, so I'll just link to a tutorial: http://drupaleasy.com/blogs/ultimike/2009/07/using-views-relationships-arguments-attachments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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