You need to sign in to do that
Don't have an account?
Carlton Banks
Problems with relationship query
I cannot get this to work. I can query each field seperately but together I get errors. Can someone please
tell me what I am doing wrong?
Code:
//connect to salesforce $client = new SforcePartnerClient(); $client->createConnection($wsdl); $loginResult = $client->login($userName, $password); $string = "SELECT Description, (SELECT TrackingNumber__c FROM Opportunity) FROM OpportunityLineItem"; $response = $client->query($string); $queryresult = new QueryResult($response); foreach($queryresult->records as $result) { $Description = $result->fields->Description; $TrackingNumber = $result->fields->TrackingNumber__c; echo "Description: " . $Description . "<br />"; echo "Tracking Number: " . $TrackingNumber . "<br /><br /><br />"; }
details from the MySQL docs: http://dev.mysql.com/doc/refman/5.0/en/join.html
Edit: on second though, JOIN might not be the answer... why don't you want to do two seperate queries? store the result of the first query in a var, then input the var in your second query... pretty fool proof.
Message Edited by EricVlach on 01-08-2009 05:50 PM
SELECT Description, Opportunity.TrackingNumber__c FROM OpportunityLineItem