You need to sign in to do that
Don't have an account?
AL
SOQL Query And/Or Help
Hello, I'm trying to create a soql query to pull account records that have a type of sub-customer. Additionally I'd like the accounts to not be linked to an association record OR the accounts can be linked to a system record where the system record's server type is retired. Below is the following query I've created, but I get an error message of unexpected token: OR. Any help would be appreciated.
SELECT Id, Name FROM Account WHERE Type = 'Sub-Customer'AND ID not IN (Select Account__c from Associations__c)
OR ID IN SELECT Primary_Account__c, Server_Type__c from System__c where Server_Type__c == 'Retired'
SELECT Id, Name FROM Account WHERE Type = 'Sub-Customer'AND ID not IN (Select Account__c from Associations__c)
OR ID IN SELECT Primary_Account__c, Server_Type__c from System__c where Server_Type__c == 'Retired'
Let's keep it simple. Use the following code snippet to keep all the query separated instead of using in the where clause.
You can change AND/OR condition as per your requirement.
Hope this will help you. If does then mark it as the best answer so it can also help others in the future.
Many Thanks,
Sunil Rathore