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
fiona gentryfiona gentry 

How to Write SOQL for Distinct of combination of Level_1__c,Level_2__c and Level_3__c

Dear gurus,

I would like to know if there is possibility of writing a SOQL similar like we do in SQL
like Distinct of Level_1__c,Level_2__c and Level_3__c

Currently SOQL is 
    
select Case__c, Level_1__c, Level_2__c,Level_3__c  FROM ERT_Case_Type__c



How to rewrite to include Distinct of Level_1__c,Level_2__c and Level_3__c

Thanks & Regards,
Fiona
Best Answer chosen by fiona gentry
fiona gentryfiona gentry
this thing helped for now using group by 
select Case__c, Level_1__c, Level_2__c,Level_3__c  FROM ERT_Case_Type__c group by Case__c,Level_1__c, Level_2__c,Level_3__c

All Answers

VinayVinay (Salesforce Developers) 
Hi Fiona,

Unfortunately, Distinct is not supported in SOQL.  Kindly review below Idea link and vote for this feature.

https://trailblazer.salesforce.com/ideaView?id=08730000000Brr2

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
fiona gentryfiona gentry
this thing helped for now using group by 
select Case__c, Level_1__c, Level_2__c,Level_3__c  FROM ERT_Case_Type__c group by Case__c,Level_1__c, Level_2__c,Level_3__c
This was selected as the best answer