Link to home
Start Free TrialLog in
Avatar of Karen Schaefer
Karen SchaeferFlag for United States of America

asked on

Help with SQL query to create and update new column

i need to create a SQL statement that will update a new column  to determine if the item in column 2 is an accessory or pc.

Using a Distinct to create the unique list of the items in question, then compare to actual data

My current thought is to use a with statement to be used within a nested query, then create a switch statement  contains a wildcard versions of the Unique Listing.

Here is my current attempt, please help me to create the best method to update the new column?

WITH ItemList AS 
(
select 	distinct  VSTS_Common_ItemType as ItemType
FROM [sql1].[table1] 
where 
[VSTS_Common_InputPath] = 'Service Center'
and System_State in ('Closed', 'Resolved')
and Common_ResolvedDate >= '01/01/2018'
					) 
Select Itemlist
from itemlist
Right inner join 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

To simplify things:
Please post sample data and expected results.

Also your database product and version.  Getting this in the correct Topic Area will get it in front of the proper Experts.
Karen,
Can you explain how the accepted solution solved the problem?
Even a small nudge can bring light into the problem... :-)