You need to sign in to do that
Don't have an account?
Simrin
Using variables for SOQL where clause
Hello,
I have a snippet like below,
I have a snippet like below,
public with sharing class customClass{ public List<CustomClassOne> x{get;set;} public customClass(){ x = Select column1 From CustomClassOne; for(CustomClassOne counter : x) { Integer i; i = Select count() From CustomClassTwo where column2=counter; } } }How can i set column2=counter in where clause ?
To add a variable in WHERE clause you have to use ':' before the variable
Select count() From CustomClassTwo where column2=:counter;
The requirement is not clear to suggest.
Assuming you are trying to find the count from CustomClassTwo where column2 is equal to the column1 of CustomClassOne.
Regards,
Bhanu Mahesh