[support] views 'WHERE NOT EXISTS' Query

Jos De Graeve jos.degraeve at gmail.com
Wed May 12 13:13:23 UTC 2010


Hi,

I am building a drupal site with views and CCK that is used to manage
a member list and payments of these members.  So i have a content type
"member" and a content type "payment".  The payment content type has a
node reference field to the "member" content type.

Now i want to build a view that lists members that have not payed in this year.

Basically, this SQL query explains (and gives me the right results)
what i am trying to query:

SELECT * FROM content_type_member
WHERE NOT EXISTS
(
SELECT * FROM content_type_payment
WHERE content_type_member.nid=content_type_payment.field_member_nid
and content_type_payment.field_jaar_value=2010
)

The problem is that i cannot figure out how to translate this query into a view.

Is this possible to build such a view ? Can anybody help me with this ?

Thanks in advance,
Jos


More information about the support mailing list