• Akshaya Mashankar
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi,

 

I am new to Apex and SOQL, and  trying to learn programing.   What I have is this code below in the class

 

public class opportunityList2Con {
    public ApexPages.StandardSetController setCon {get {
            if(setCon == null) {setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select name, Amount, ExpectedRevenue, closedate from Opportunity]));
            }
            return setCon;
        }set;
    }
    public List<Opportunity> getOpportunities() {
         return (List<Opportunity>) setCon.getRecords();
    }
}

 Then this code in the page Test1:

<apex:page controller="opportunityList2Con">
    <apex:pageBlock >
        <apex:pageBlockTable value="{!opportunities}" var="o">
            <apex:column value="{!o.name}"/>
            <apex:column value="{!o.Amount}"/>
            <apex:column value="{!o.ExpectedRevenue}"/>
            <apex:column value="{!o.closedate}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 So this is pulling a list of Opportunities with some fields.  However, I would like to edit a query to JOIN with other objects CASES and TASKS to pull any cases or tasks/events that associate with the opportunity, but I couldn't figure out the query.   so example I would like to so the Join tables like this in MSSQL or Oracle8.  

 

Select from op.name, op.amount, c.number, c.subject, a.subject, a.AssignedTo

From Opportunity op, Case c, a.Activity

Where

op.caseID = c.caseID

c.ActivityID = a.ActivityID.

 

This query example is bad, but I want to use it so you would know what i am trying to accomplish.

 

Any advice would be appreciated,

 

Thanks,