Solved

Get Related topics based on WordWeight

Posted on 2014-01-29
8
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 66

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

717 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