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
hassabhassab 

Case statement in SOQL?

Hi all,

 

Is it possible to have a case statement in a SOQL query?  I am attempting to combine multiple lookup fields that are various contacts associated with a contract into a single related list, where the list would contain the specific role of the contact (signee, contractee, a few custom fields, etc.).  Is SQL i'd do this with a case statement but SOQL doesn't seem to like it.  Any thoughts?  Here's my query:

 

Select id, Name, Status, Amount__c, Contract_Date__c
            from Contract 
            where CompanySignedID = :con.id
                or OwnerID = :con.id
                or CustomerSignedID = :con.id

                or Consultant__c = :con.id
                or Signee__c = :con.id
                or Organization_Contact__c = :con.id

 

If SOQL doesn't do case statements, any ideas how I could designate which of these fields the contact is assiged to?

 

Thanks,

Hassab