I am trying to generate a query in APEX related to the Opportunity
and Contact
objects. I want to select Opportunities based on the info contained in the FirstName
field of the linked Contact
.
In SQL I would join the tables and then select but in SOQL we use sub-queries. I tried to pattern mine off the answer to this question which successfully used sub-queries but I don't yet get the 'SOQL' way.
My most current failing query is:
SELECT
Name,
(SELECT
FirstName
FROM
Contact)
FROM
Opportunity
WHERE
FirstName IN (SELECT FirstName FROM Contact WHERE FirstName = 'Jane')
Any ideas?