There are two related content types and I wanted to find the total of one content type entries applied against another.
I have two content types job and resumes. I need to display the total no of applications against ‘job’ as a field in my view.
According to me the best way to achieve this is through the module View Custom Field. Upload and enable the module.
Now go to your view add a field and select Customfield: PHP code.
Write the appropriate code to extract the total no of rows directly from the database. In my case it is the following:
<?php $nid = $data->nid; $test = db_result(db_query("SELECT count(uid) FROM job WHERE nid='$nid'")); print $test; ?>
Note: This is for drupal 6