AnsweredAssumed Answered

K Report query question

Question asked by Jonathan Goodman on Sep 14, 2015
Latest reply on Sep 17, 2015 by christianknoll christianknoll
I'm working on a K report that should show when the campaign related to an opportunity doesn't match the latest campaign for a contact associated with the opportunity.

I've selected contacts as the main module of the report. The contacts module has a campaign id field which I want to check is not equal to the campaign id on the opportunity module related to each contact. In K reports I can't seem to find a way of setting a condition like this. Do anyone know a way of doing this or have any suggestions?

As a temporary solution I've used SQL which might help explain:
SELECT     contacts.campaign_id as 'Contacts latest campaign',    opportunities.campaign_id as 'Opportunities related campaign'  FROM contacts, opportunities_contacts, opportunities  WHERE contacts.id = opportunities_contacts.contact_id  AND opportunities_contacts.opportunity_id = opportunities.id  AND contacts.campaign_id != opportunities.campaign_id  AND contacts.campaign_id != "";

Using sugar 6.5, K reports 3.1

Outcomes