0

So i have Two Queries

  1. SELECT Id, DurableId FROM FieldDefinition WHERE EntityDefinitionId ='Student__c' AND QualifiedAPIName = 'Hobby__c'

What i want to do is take the DurableId from the above Query and add in to Second query below

  1. SELECT DurableId,EntityParticleId,Id,IsActive,IsDefaultValue,Label,ValidFor,Value FROM PicklistValueInfo where EntityParticleId =_DurableId_From_First_Query

I know it is possible in apex code But,

Is is possible to make it a single SQOL query, how can i achieve this in a single query ?

1 Answer 1

0

Yes it is possible, using the IN operator. use the 1st query in the where clause of the 2nd query, like this:

SELECT DurableId... FROM PicklistValueInfo 
WHERE EntityParticleId In 
(SELECT DurableId FROM FieldDefinition WHERE EntityDefinitionId ='Student__c' AND QualifiedAPIName = 'Hobby__c' )
2
  • This (semi-joins) is the general answer to this sort of problem. However, from what I've tried, it does not work in this particular case.
    – Derek F
    Commented Feb 11, 2023 at 22:53
  • Thank You @Json, but i have tried doing the same but it does not works.
    – Aman Patil
    Commented Feb 12, 2023 at 9:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .