+ Reply to Thread
Results 1 to 2 of 2

Thread: Need help with relational query

  1. #1
    alt
    alt is offline Junior Member
    Join Date
    Feb 2009
    Posts
    1

    Question Need help with relational query

    How can I add a WHERE clause in my query (see below) to select only the Project results WHERE the Communications.createdbyid is according to a result?

    The parallel MySQL example I am trying to get is:
    SELECT * FROM Project_info__c INNER JOIN Communicatiions__c ON (Project_info__c.id = Communicatiions__c.id) WHERE Communicatiions__c.createdbyid = 'some date'

    Code:
    <complexType name="Project_info__c">
        <complexContent>
            <extension base="ens:sObject">
                <sequence>   
                <...cut...>                     
                <element name="Communications__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>
                <...cut...>                     
                </sequence>
            </extension>
        </complexContent>
    </complexType>
     
    =======================================
     
    <complexType name="Communicatiions__c">
        <complexContent>
            <extension base="ens:sObject">
                <sequence>
                <...cut...>                     
                <element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
                <...cut...>                     
                </sequence>
            </extension>
        </complexContent>
    </complexType>
     
    ============================
     
    php:
    $query = "SELECT 
                                    Id,
                                    Name,
                                    Status__c ,                             
                                    (SELECT Name,CreatedById FROM Communications__r),                               
                                    FROM Project_info__c 
                                    ";

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15
    alt

    Have you doanloaded eclipse so you can test your queries there? that is where I test all my queries and it is the best place to get them working

    Joins are not that easy in Salesforce and the technology is improving for their joins, but still not up to par when you compare it to a database like oracle or Mysql

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.1