function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mikenjmikenj 

SOQL Expression Help

Hello,
 
I need an Soql expression to select all the contact records that have a valid AccountId. 
 
I was going to use

select AccountId,Id,FirstName, LastName from Contact Where IsDeleted=False And Len(RTrim(AccountId)) > 0

but this does not work.

 

Can someone help me?

 

Thanks,

 

SuperfellSuperfell
select AccountId,Id,FirstName, LastName from Contact where accountId != NULL

You don't need the IsDeleted filter unless you're using queryAll.