MadIce
asked on
Using Right() in case statement
I have a query like the following:
Select Item, StartDate,
Case when Right(lot, 1) in ('A', 'B', 'C') then 'Suffixed'
else '' end as ItemNote
From Table1
This doesn't seem to like the "IN ('A', 'B', 'C')". What can I use other then writing a long "Or This" string.
Select Item, StartDate,
Case when Right(lot, 1) in ('A', 'B', 'C') then 'Suffixed'
else '' end as ItemNote
From Table1
This doesn't seem to like the "IN ('A', 'B', 'C')". What can I use other then writing a long "Or This" string.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yep, nothing wrong with that, it should work just fine.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
In the results it will add the note to all the ones it should but will also add to some that it shouldn't. For example:
www123-001
this one adds the note and shouldn't. where the following it doesn't:
www123-002.
The Right() seems to be no problem. I Took out the In portion and made it = 'A' just to test. No problem. I might just need to do update statements after the initial query. It just bugs me I can't see the issue. I also can't post the actual query for further help.
www123-001
this one adds the note and shouldn't. where the following it doesn't:
www123-002.
The Right() seems to be no problem. I Took out the In portion and made it = 'A' just to test. No problem. I might just need to do update statements after the initial query. It just bugs me I can't see the issue. I also can't post the actual query for further help.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Madice, your issues was resolved?
If not, do you want to reformulate it?
If not, do you want to reformulate it?
Works for us. Thanks for the split and for posting the eventual answer. Good luck with your project. -Jim
ASKER
Since the issue was a type O, I'm just spreading the points out for looking over the question. Thanks for the assistance. This should of been closed out before. Not sure what happen. Sorry for the delay.