469,642 Members | 1,211 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,642 developers. It's quick & easy.

RE: CASE Statement, works but.....

28
My CASE Statement works fine like this:


================================================== =======
CASE

WHEN so.PhoneNum LIKE '999%' THEN 'Chester'

END AS Company, (Works!)
================================================== =====

But how can I get it to work checking more than 1 instance of PhoneNum?

This doesn't work:

================================================== ====
CASE

WHEN so.PhoneNum LIKE '999%' THEN 'City1'
WHEN so.PhoneNum LIKE '997%' THEN 'City2 '
WHEN so.PhoneNum LIKE '998%' THEN 'City3'

END AS Company, (Fails!)
================================================== ====

This fails with an out put of "NULL"

Thanks
Sep 12 '07 #1
1 898
dhutton
28
Found the solution - this works!

[Company] =
CASE
WHEN so.PhoneNum LIKE '999%' THEN 'Chester'
WHEN so.PhoneNum LIKE '998%' THEN 'Camden'
WHEN so.PhoneNum LIKE '997%' THEN 'Great Falls'
WHEN so.PhoneNum LIKE '803%' THEN 'Winnsboro'
END,
Sep 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

17 posts views Thread by Newbie | last post: by
5 posts views Thread by Ryan | last post: by
3 posts views Thread by mark.irwin | last post: by
2 posts views Thread by scole954387 | last post: by
17 posts views Thread by Navodit | last post: by
13 posts views Thread by Satya | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.