Link to home
Start Free TrialLog in
Avatar of intoxicated_curveball
intoxicated_curveball

asked on

Help with SQL query, order by number matches

I have a news table with a related keywords table.

So on each news page I just want to be able to list the top 3 related news items ordered by the most matching keywords. I'm just not sure how to best query this?

So there are three tables:

News table

Keywords table

News :: Keywords table
Avatar of Bitsqueezer
Bitsqueezer
Flag of Germany image

Hi,

I have an example on my download site for Access, "BestMatchV3". This gives a point for each found word in a text and then counts the points of the result and sort it so the best match is that with the most points. That should be easily translated in any other database.

Cheers,

Christian
Avatar of intoxicated_curveball
intoxicated_curveball

ASKER

Hi Christian, there is already a table for the keywords. So there is no need to scan the text. Also, I'm looking for help with the SQL.
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India 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
Hi Pawan, that query doesn't really make sense to me. It is specifically the related table News :: Keywords table that needs to be queried, I think.
can you send rows from all the three table and how these tables are joined and the expected output.
Pawan, I just figured it out using your suggestion.
cool :)