+ Start a Discussion
AnicheAniche 

SOQL help!

Hi,
 
I have a small problem in SOQL query that i am writing.
I am setting the value of a variable in a trigger and want to use the variable in the SOQL "Where" clause.
 
Example
 
String Grp_Id = new[0].ParentId;
 
Interger count  = [ Select count() from Account a where a.ParentID = Grp_Id]; 
 
How do i define Grp_Id in SOQL so that during run time it will pickup the value that it will get .
I have tried  +Grp_Id , '+ Grp_Id ' but all in vain.
 
Thanks
SuperfellSuperfell
Interger count = [ Select count() from Account a where a.ParentID = :Grp_Id];
AnicheAniche
Thanks Simon...