Solved

Get Related topics based on WordWeight

Posted on 2014-01-29
8
151 Views
Last Modified: 2014-01-31
Dear all,
I have tale NewsSYSNewsTags (NewsSYSNewsTagsID PK, NewsID (fk), NewsSYSTagsID (fk)WordWeight

for given NewsID how can get the most related newsID

thanks
0
Comment
Question by:ethar1
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39818494
>for given NewsID how can get the most related newsID
Define 'most related', preferable with some mockup 'before and after' data.  

Where I'm from you could be cousins multiple ways.
0
 

Author Comment

by:ethar1
ID: 39818499
based on WordWeight as mentioned
0
 
LVL 16

Expert Comment

by:Surendra Nath
ID: 39818619
what is meant my word weight is it another column in a different table or word weight is some kind of functional requirement.

if it is the later, can you please take an example and explain to us.
0
 

Author Comment

by:ethar1
ID: 39818936
Table :
 NewsSYSNewsTags (NewsSYSNewsTagsID PK, NewsID (fk), NewsSYSTagsID (fk), WordWeight)

yes its a column in same table  its a float field.
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 16

Expert Comment

by:Surendra Nath
ID: 39818956
ok, can you please give us some examples with the data for the table and also the output that you are expecting..

while providing this data, please let us know how this output has come up...
The data can be a dummy data nothing in your real tables.
0
 
LVL 12

Expert Comment

by:Harish Varghese
ID: 39819956
Are you looking for NewsIDs with NewsTags having same WordWeight as given NewsID?
If there are multiple NewsTags in the given NewsID, what should be the criteria to pick the other relevant NewsID?
0
 

Author Comment

by:ethar1
ID: 39819983
@Harish Varghese, yes this is exactly what I am looking for , sure there are multiple NewsTags in the given NewsID.
The criteria (fmho):
for each NewsSYSTagsID of given NewsID
insert in releated table
select  NewsID  where WordWeight = +- 5% of (WordWeight  of GivenNewsID) and NewsID <> given NewsID
order by WordWeight  Desc


thanks
0
 
LVL 12

Accepted Solution

by:
Harish Varghese earned 500 total points
ID: 39819993
Hello,

Here is a query to identify the related news. I am selecting the news tag id and the word weights for the given news id and related news id. You may pick only the columns you want finally.
Insert into @RelatedNewsIDs (MainNewsID, NewsSYSTagsID, MainWordWeight, RelatedNewsID, RelatedWordWeight)
Select Distinct Main.NewsID, Main.NewsSYSTagsID, Main.WordWeight, Related.NewsID, Related.WordWeight
From NewsSYSNewsTags Main, NewsSYSNewsTags Related
Where Related.NewsID <> Main.NewsID
And Related.NewsSYSTagsID  = Main.NewsSYSTagsID 
And Related.WordWeight >= Main.WordWeight - Main.WordWeight * .05 
And Related.WordWeight <= Main.WordWeight + Main.WordWeight * .05 
And Main.NewsId = 1001 --Your news ID to search

Open in new window

-Harish
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now