Solved

Get Related topics based on WordWeight

Posted on 2014-01-29
8
154 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 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
read Json fields and insert all the content into a table by Store Procedure 4 24
Change this SQL to get all nodes 3 40
SQL Select Query help 1 38
SQL Syntax 6 41
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

733 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