Hi I am trying to add a virtual field via a substring, however I am having difficulties when trying to compare more the one substring.
For example
SELECT location, sales, Month, Year, CASE WHEN Substring([location], 1, 8) = '12345678' OR '24578914' THEN 'Location A' END AS Storage
FROM Sales
Does anyone know how to compare more than one substring value within a statement rather than creating a case for each.
Case Statement
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

brunda kRank #3,804 · 389 reputationPosted Mar 11, 2013, 10:06 AM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 11, 2013, 8:03 PM EDT
try...
SELECT location, sales, Month, Year,
CASE Substring([location], 1, 8) WHEN '12345678' THEN 'Location A' WHEN '24578914' THEN 'Location B' ELSE 'Location C' END AS Storage
FROM Sales
hope this will solve your problem.