Hello,
I'm working actualy on a specific website project and I have a problem to defined a complex query with views. i didn't find the solution yet, so maybe someone could give me help.

Here is the context:

I have created nodes that describe EXPERIENCES (Organic) with differents data fields..

I have created a node named "RESULT" (EntityForm type) that allow to register several context result of an activity.
It contains 2 required main fields that allow to select 2 EXPERIENCES through an EntityReference list box as decribed bellow:

RESULT
- Field1 "Source": Entity reference on EXPERIENCE for selection
- Field2 "Target": Entity reference on EXPERIENCE for selection

So it is possible for example to store the data bellow with the RESULT EntityForm:

RESULT 1 Source: EXP100 Target:EXP300
RESULT 2 Source: EXP100 Target:EXP400
RESULT 3 Source: EXP200 Target:EXP300
RESULT 4 Source: EXP200 Target:EXP300
RESULT 5 Source: EXP200 Target:EXP400
RESULT 6 Source: EXP300 Target:EXP100
RESULT 7 Source: EXP400 Target:EXP200

And i have created a VIEW to display this list (with more informations off course) but i need more....

My Question:
How it is possible to create a DRUPAL VIEW to select the RESULT lines where EXPERIENCE are referenced each other through fields "Source" and "Target" as described bellow ?:

RESULT1 Source: EXP100 Target:EXP300
RESULT6 Source: EXP300 Target:EXP100
RESULT5 Source: EXP200 Target:EXP400
RESULT7 Source: EXP400 Target:EXP200

The SQL query for this result can be written as:

SELECT r1.source, r1.target
FROM `RESULT` r1, `RESULT` r2
WHERE r1.source = r2.target AND r1.target = r2.source

Thanks in advance for your Help.

Best Regards.

David.

Comments

Jaypan’s picture

https://www.drupal.org/node/643758

You can move the thread by editing the original post and choosing 'Post Installation' as the forum.

Thank you.