SQLite Forum

nested case statement not working
I though trailing spaces may be the issue.

You can fix that by any one of  
  - adding the trailing space (as in `WHEN 'ANALYST ' then`)  
  - adding the builtin collation rtrim to the comparison (as in `WHEN 'ANALYST' collate rtrim THEN`)  
  - adding `collate rtrim` to the column definition  
  - updating the table to remove the trailing spaces

The built-in `rtrim` collation is specifically designed to ignore trailing spaces during text comparisons.