How to join two Drupal CCK content types in view without a node reference field, fast? Users uploaded two csv files to create nodes for two CCK content types (Delivery Note and Payment), i.e.

 Delivery       Payment
----------     ---------
 Order No.      Order No.
 Recipient      Charge
 Address


I would like to create a view as a report for the boss:

 Order No.  Recipient  Charge
 ---------  ---------  -------
  ...        ...        $...
  ...        ...        $...
  ...        ...        $...


Order No. field is unique and both content types.

How's it possible to do it in Drupal's view?



The above question was asked on SO and I found a solution. However, the solution was way too slow (for example, it takes more than a hour to download ~2000 records via Views Data Export).
Since you don't have a reference between the two, Views has no way of knowing how the node's relate to eachother. Views has no direct support for joining on arbitrary columns.

So to solve this, you need to declare the relationship to Views your self. You do this by implementing hook_views_data, or in this case, since Views has likely already created most of the array, hook_views_data_alter. The documentation for the first function has an example with code for a relationship.