create chains of views joins so one view can 'see' across more than one join Assuming the individual joins work can we join multiple times across columns like this?... (BTW I've checked this first query and it does indeed work correctly)

SELECT *
FROM a
LEFT JOIN b
ON a.a_id = b.references_a_id
LEFT JOIN c
ON b.references_c_id = c.c_id
LEFT JOIN d
ON c.references_d_id = d.d_id


As per the following table.column structure:

a.a_id
a.a_col

b.b_id
b.references_a_id
b.references_c_id
b.b_col

c.c_id
c.references_d_id
c.c_col

d.d_id
d.d_col


Is it possible to link these together in a view so that because we have the joins defined in hook_views_data_alter() we can have the following:

pseudo-description of the Views setup:

(views setup)

"SHOW" 'a'

...

"FIELDS" &gt; "add" &gt; overlay menu "Add fields" &gt;
    a: a_id
    a: a_col
    b: b_id
    b: references_a_id
    b: references_c_id
    b: b_col
    c: c_id
    c: references_d_id
    c: c_col
    d: d_id
    d: d_col


So because this is not working for me... in hook_views_data_alter()

$data['b']['table']['join']['a']['left_field'] = 'a_id';
$data['b']['table']['join']['a']['left_table'] = 'a';
$data['b']['table']['join']['a']['field'] = 'references_a_id';
$data['b']['table']['join']['c']['left_field'] = 'c_id';
$data['b']['table']['join']['c']['left_table'] = 'c';
$data['b']['table']['join']['c']['field'] = 'references_c_id';
$data['c']['table']['join']['d']['left_field'] = 'd_id';
$data['c']['table']['join']['d']['left_table'] = 'd';
$data['c']['table']['join']['d']['field'] = 'references_d_id';


... I wonder if I should be doing something bizarre like this...

$data['b']['table']['join']['a']['left_field'] = 'a_id';
$data['b']['table']['join']['a']['left_table'] = 'a';
$data['b']['table']['join']['a']['field'] = 'references_a_id';
$data['b']['table']['join']['c']['left_field'] = 'c_id';
$data['b']['table']['join']['c']['left_table'] = 'c';
$data['b']['table']['join']['c']['field'] = 'references_c_id';
$data['b']['table']['join']['c']['left_table']['c']['join']['d']['left_field'] = 'd_id';
$data['b']['table']['join']['c']['left_table']['c']['join']['d']['left_table'] = 'd';
$data['b']['table']['join']['c']['left_table']['c']['join']['d']['field'] = 'references_d_id';
I added a relationship to the mix and that's opened up two extra sets of fields ('c' and 'd') I can't explain why, I think it's something to do with the joins that were already setup on these base tables. This then meant that when I bridged them with the relationship it opened it all up.

example:

$data['a']['a_id']['relationship']['handler'] = 'views_handler_relationship';
$data['a']['a_id']['relationship']['base'] = 'b';
$data['a']['a_id']['relationship']['base field'] = 'references_a_id';
    (... etc.)