Hi there,
I have a database of financial deals that I wish to show tables of according to which banks led the deals. There are two fields that the banks can be listed in: lead managers or self leaders.
I have set up a view with views OR arguments to make a query that finds all deals where the deal year = 2009 where AND (the lead manager = bankx OR the self leader = bankx).
The table displays the date, the deal name, the dollar amount, and the lead managers and self leads.
The query finds the deal list ok, but it doesn't display the self lead unless the self lead = bankx , eg
Deal A , self lead by bankx displays as expected
Deal B, self lead by banky , lead managers bankx and bankz shows the leads but not the self leader.
I had a look at the SQL the view generates:
SELECT node.nid AS nid,
node_data_field_launchdate.field_launchdate_value AS node_data_field_launchdate_field_launchdate_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_issuer.field_issuer_value AS node_data_field_issuer_field_issuer_value,
node_data_field_amount_audequiv.field_amount_audequiv_value AS node_data_field_amount_audequiv_field_amount_audequiv_value,
node_data_field_self_lead_value_0.field_self_lead_value AS node_data_field_self_lead_value_0_field_self_lead_value
FROM node node
LEFT JOIN content_type_deal node_data_field_launchdate ON node.vid = node_data_field_launchdate.vid
INNER JOIN content_field_facility node_data_field_facility ON node.vid = node_data_field_facility.vid
LEFT JOIN content_field_leads node_data_field_leads_value_0 ON node.vid = node_data_field_leads_value_0.vid AND node_data_field_leads_value_0.field_leads_value = 'JPMorgan'
LEFT JOIN content_field_self_lead node_data_field_self_lead_value_0 ON node.vid = node_data_field_self_lead_value_0.vid AND node_data_field_self_lead_value_0.field_self_lead_value = 'JPMorgan'
LEFT JOIN content_field_issuer node_data_field_issuer ON node.vid = node_data_field_issuer.vid
LEFT JOIN content_field_amount_audequiv node_data_field_amount_audequiv ON node.vid = node_data_field_amount_audequiv.vid
WHERE (((node.type in ('deal')) AND (node.status <> 0) AND (node_data_field_facility.field_facility_value IN ('Senior domestic AMTN', 'Senior domestic AMTN (GG)', 'Senior domestic AMTN (non GG)', 'Subordinated domestic AMTN', 'Senior Kangaroo', 'Subordinated Kangaroo')) AND ((node_data_field_launchdate.field_sector_value) != ('Semi government'))) AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_launchdate.field_launchdate_value, '%Y-%m-%dT%T'), '%Y') <= '2009' AND DATE_FORMAT(STR_TO_DATE(node_data_field_launchdate.field_launchdate_value, '%Y-%m-%dT%T'), '%Y') >= '2009')))
AND ((node_data_field_leads_value_0.field_leads_value = 'JPMorgan') OR (node_data_field_self_lead_value_0.field_self_lead_value = 'JPMorgan'))
ORDER BY node_data_field_launchdate_field_launchdate_value DESC
I think the problem is with the LEFT JOIN condition:
LEFT JOIN content_field_self_lead node_data_field_self_lead_value_0 ON node.vid = node_data_field_self_lead_value_0.vid AND node_data_field_self_lead_value_0.field_self_lead_value = 'JPMorgan'
This shouldn't have the stuff after the AND, I think.
Am I doing something wrong, or is this due to a bug?
Thanks in advance.
Comments
Comment #1
socialnicheguru commentedi am getting the same thing. The query is empty even though the view is displayed for the test conditions for the argument when they are not in the view_or config.
Chris
Comment #2
darren ohI did some work on arguments yesterday and cannot reproduce this. Please confirm that the problem exists in the current code.
Comment #3
darren ohDuplicate of #644174: Share arguments won't work.