Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Grouping Help

Author  Topic 

Scott28
Starting Member

2 Posts

Posted - 2012-11-01 : 06:27:35
Hi All,

New to SQL and this forum, so apologies if I`ve posted in the wrong area or if I`m not specific enough.

I am trying to group together items with similar names. I`ve written the following, it works absolutely fine, but when I add a similar name which contains mostly the same alphanumeric value it breaks.



WHEN UPPER("Information(Problem) Summary Reporting".Mobile Device Model) LIKE '%GALAXY S III%' THEN 'Galaxy S III'
WHEN UPPER("Information(Problem) Summary Reporting".Mobile Device Model) LIKE '%GALAXY S II%' THEN 'Galaxy S II'
ELSE "Information(Problem) Summary Reporting".Mobile Device Model
END


I assume the error is the fact the second criteria is matches the first minus one character.

It groups the Galaxy S III variants correctly, but doesn`t work on the Galaxy S II.

Any thoughts?

Many thanks,

Scott

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-11-01 : 06:44:41
try:

WHEN UPPER("Information(Problem) Summary Reporting".Mobile Device Model) LIKE '%GALAXY S III%' THEN 'Galaxy S III'
WHEN UPPER("Information(Problem) Summary Reporting".Mobile Device Model) LIKE '%GALAXY S II[^I]%' THEN 'Galaxy S II'



Too old to Rock'n'Roll too young to die.
Go to Top of Page

Scott28
Starting Member

2 Posts

Posted - 2012-11-02 : 05:29:32
Will give it a try. Thanks!
Go to Top of Page
   

- Advertisement -