Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Keyword mapping Expand / Collapse
Author
Message
Posted Tuesday, August 27, 2013 9:28 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, April 4, 2014 5:57 AM
Points: 2, Visits: 9
I have two tables setup where one contains a list of keywords and category The second table contains actual data description. By mapping the keywords on the Data description column, we will have to update the respective category.

Can we achieve the same using a Query or we have to write a Procedure?
Post #1489008
Posted Wednesday, August 28, 2013 6:27 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 9:01 AM
Points: 4,439, Visits: 6,347
Please provide sample tables, data, and expected output. We can't do much for you without that as a starting point. Also, I don't understand your question about query or procedure...

Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #1489164
Posted Wednesday, August 28, 2013 7:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, April 4, 2014 5:57 AM
Points: 2, Visits: 9
Hi,

I am here by attaching a sample excel workbook where we have two worksheets, one represents the first table and second worksheet represents the issues table which needs to be updated on the category column based on the Keywords available in the Keywords table.

As this is a sample, we have few rows.. in reality there are more than a lakh of rows in the Issues table.

My query was with regards to a SQL query with which we can update the categories on the Issues table based on the Keywords table.

Thanks,
Ram240582


  Post Attachments 
Mapping.xlsx (2 views, 9.72 KB)
Post #1489187
Posted Wednesday, August 28, 2013 1:01 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 9:01 AM
Points: 4,439, Visits: 6,347
I don't open excel spreadsheets from the web.

Sorry, I wasn't specific enough in my request. I (and others that might help you) need CREATE TABLE scripts (temporary tables please, not permanent ones) and INSERT ... scripts that we can run directly on SQL Server to use to build a query that can help solve your problem. We need your expected outputs from the given inputs so we can really understand what you mean/need.


Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #1489392
Posted Wednesday, August 28, 2013 3:30 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 3:28 PM
Points: 817, Visits: 743
If this is a one-off you could do:

UPDATE issues
SET category = (SELECT MIN (k.category)
FROM keywords k
WHERE i.description LIKE '%' + k.keyword + '%')
FROM keywords k

I will be really slow.

If you need to do this on a regular basis, you need to consider full-text indexing.


Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Post #1489435
Posted Wednesday, August 28, 2013 5:20 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 5:25 PM
Points: 35,615, Visits: 32,210
Ram240582 (8/27/2013)
I have two tables setup where one contains a list of keywords and category The second table contains actual data description. By mapping the keywords on the Data description column, we will have to update the respective category.

Can we achieve the same using a Query or we have to write a Procedure?


Welcome aboard. To get better and quicker answers in the future, most likely with a coded example that actually works, please see the first link in my signature line below.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1489471
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse