Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have two tables that I have specified as join for as follows in hook_views_data:
$data['market_data_summary']['table'] = array(
'group' => t('Market Data'),
'join' => array(
'market_data' => array(
'left_field' => 'mmid',
'field' => 'mmid',
),
),
);
My problem is that these two tables actually have a multiple-column key. How can I specify more than one key association? Currently I am joining ON the mmid field in both tables -- but ideally I'd like to be able to join ON mmid AND pid AND cid (for example).
Comments
Comment #1
dawehnerSee this comment
I hope it helps you.
Comment #2
ISPTraderChris CreditAttribution: ISPTraderChris commentedThe following works in a very simple view -- this makes use of the 'extra' parameter.
My concern with this approach is that I have to manually alias one of the tables (the table with the 'value') -- and I have a feeling this will break down when the view gets more complex. Is this still the best approach? Is there some way to force views to provide the alias it is using?
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedYou may have to write your own views_join handler for that.
Comment #4
iamjon CreditAttribution: iamjon commentedISPTraderChris,
Were you ever able to solve the problem? If so please share so others can benefit, if not please update so we can better try help you.
Comment #5
iamjon CreditAttribution: iamjon commentedComment #6
ufku CreditAttribution: ufku commentedComment #7
MustangGB CreditAttribution: MustangGB commentedNo idea why this was re-opened, but 8.x issues are handled by core.
Comment #8
dawehnerThere is no reason to open this up again.