You need to sign in to do that
Don't have an account?
birdofprey
SOQL SELECT Where IN Clause in PHP
I try doing a Where IN CLause from php where my $campaignID is a 1-dem array, any ideas if thise works?
SELECT Id FROM Campaign WHERE Id IN ('$campaignID')
Hi,
Hopefully this helps. I used COUNT, IN and GROUP BY successfully using the below query string.
$query = "SELECT fieldone__c, COUNT(Id) from table__c WHERE fieldtwo__c IN (" . $this->sClass->csv . ") GROUP BY fieldone__c";
Note: $this->myClass->csv = 'M0010', 'M0009'
This means the PHP inturperter will create the following string.
SELECT fieldone__c, COUNT(Id) from table__c WHERE fieldtwo__c IN ('M0010', 'M0009') GROUP BY fieldone__c
Lastly, make sure you have the correct field name before the IN clause.
Regards,
Doug C.
All Answers
As far as I know, $campaignID should be a comma separated string of strings in this case
in your case, when PHP makes the call, salesforce should see something like this:
SELECT Id FROM Campaign WHERE Id IN ('00190000003Ncuo', '00190000003Ncuj')
Hi,
Hopefully this helps. I used COUNT, IN and GROUP BY successfully using the below query string.
$query = "SELECT fieldone__c, COUNT(Id) from table__c WHERE fieldtwo__c IN (" . $this->sClass->csv . ") GROUP BY fieldone__c";
Note: $this->myClass->csv = 'M0010', 'M0009'
This means the PHP inturperter will create the following string.
SELECT fieldone__c, COUNT(Id) from table__c WHERE fieldtwo__c IN ('M0010', 'M0009') GROUP BY fieldone__c
Lastly, make sure you have the correct field name before the IN clause.
Regards,
Doug C.