AnsweredAssumed Answered

eSQL Case Statement

Question asked by DanielShanahan on Sep 24, 2014
Latest reply on Sep 29, 2014 by DanielShanahan

I'm using the CASE statement in an ExecuteSQL () function but having the results are confusing to me.

 

I have two fields:

area_description

area_descriptiona

 

Both fields are text fields and both are indexed. Both fields are populated with the same data. Neither field is a global.

 

This works:

ExecuteSQL ( 
 " SELECT area_description, COUNT ( area_description ),
 CASE area_description
 WHEN 'Section C - Restroom (Men)' THEN '▼'
 ELSE '▶'
 END


 FROM projectFinding 
 WHERE projectID=? GROUP BY area_description " ;
 "…" ; "" ; PROJECTFINDING::projectID 
)

Result:

Section A - Parking Lot…2…▶
Section B - Path of Travel…3…▶
Section C - Restroom (Men)…5…▼
Section C - Restroom (Women)…1…▶

 

 

 

 

But this does not:

ExecuteSQL ( 
 " SELECT area_description, COUNT ( area_description ),
 CASE area_descriptiona
 WHEN 'Section C - Restroom (Men)' THEN '▼'
 ELSE '▶'
 END


 FROM projectFinding 
 WHERE projectID=? GROUP BY area_description " ;
 "…" ; "" ; PROJECTFINDING::projectID 
)

Result:

?

 

 

The only difference is the CASE statement. The first CASE uses the field area_description and the second CASE uses the field area_descriptiona. Other than that, the statements are identical.

 

 

Can anyone tell me why?

Outcomes