0

Trying to use Case in SOQL's select. SOQL doesn't like that one bit! Any ideas what's the equivalent of Case?

My code should be something like: SELECT Client_Account__c,

CASE Max(Termination_Date__c) <= TODAY

THEN Termination_Date__c

ELSE 'Active'

FROM Plan__c

GROUP BY Client_Account__c

LIMIT 100

2 Answers 2

2

There is no equivalent in SOQL. More to the point, you'll need some code. You'd have to query all rows, then determine which one you'd like to use.

0
1

You can also create a formula field with an equivalent CASE statement in it, and then query that formula field using SOQL - which would give you the same result without writing any Apex.

1
  • Thank you, for our uses I can just pull the date alone.. I was just trying to go the extra mile :)
    – FEK
    Commented Jan 26, 2015 at 19:21

You must log in to answer this question.

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