我正在使用apex和salesforce的东西。我有一些帐户的列表,现在我需要创建另一个有效的帐户列表。所以想象一下这个清单:
List<Account__c> accounts = [Select Name, Status From Account__c];
.
.
.
// now I need a new list with all the accounts that the status == 'valid'
//this is not working
List<Account__c> accounts = [Select Name, Status From :accounts
where status == 'valid'];
有没有办法获得清单?
答案 0 :(得分:0)
请查看以下查询:
列出帐户= [选择姓名,来自Account__c的状态]; 。 。 。 //现在您需要一个新列表,其中包含状态为==&#39;有效&#39;
的所有帐户列出帐户= [选择姓名,来自帐户的状态 status =&#39;有效&#39; AND id IN:accounts];
答案 1 :(得分:0)
试试这个:
List<Account__c> accounts = [Select Id, Name, Status From Account__c];
List<Account__c> otherAccounts = [Select Name, Status From Account__c where Id IN :accounts AND status = 'valid'];