Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8803665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:23:59+00:00 2026-06-14T01:23:59+00:00

This question is similar to this one but with a difference: I have eight

  • 0

This question is similar to this one but with a difference: I have eight different types of tags.

Something like this:

videos      [id, title]
tags1       [id, tag]
tags2       [id, tag]
tags3       [id, tag]
tags4       [id, tag]
tags5       [id, tag]
tags6       [id, tag]
tags7       [id, tag]
tags8       [id, tag]
video_tags1 [vid_id, tag_id]
video_tags2 [vid_id, tag_id]
video_tags3 [vid_id, tag_id]
video_tags4 [vid_id, tag_id]
video_tags5 [vid_id, tag_id]
video_tags6 [vid_id, tag_id]
video_tags7 [vid_id, tag_id]
video_tags8 [vid_id, tag_id]

Given a single video.id I want to pick out related videos based on which have the most tags in common. I’m finding it hard to find a way to do this, let alone a way that won’t bring the server to it’s knees.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:24:00+00:00Added an answer on June 14, 2026 at 1:24 am

    If you can change your database model then these proposal may fit you.

    Redefine your tables in this way :

    videos      [id, title]
    tags    [id, tag_type,tag]
    videos_tags [vid_id, tag_id]
    

    you may also add a tag_type table (which will have 8 rows, one for each of yourtag types) for more consistency.

    Then this query (it may has some syntax error, but my intention is that you get the idea) will give you the video ids and the number of matching tags with the one provided :

    select 
           videos.id, count(videos.id) as nEqualTags 
    from 
           videos videos inner join  video_tags vtags on  (vtags.vid_id=videos.id )
    where 
           vtags.tag_id in (select tag_id from videos_tags where vt.id = ?) 
    group by 
           videos.id 
    order by 
           nEqualTags desc
    

    You may add some more logic in order to cut down the results if the nEqualTags is lower than certain value.

    (And also consider adding some index for better performance).

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question is similar to this one , but I would like to replicate
This question is similar to this one, but with an extra wrinkle: Auto-removing all
My question is similar to this one but none of the answers solve my
my question is similar to this one , but I don't want to use
My question is similar to this one , but I can simplify it some.
The question is quite similar to this one , but I need to concentrate
My question popped up a very similar question, this one . But the accepted
Similar to this question but with a difference subtle enough that I still need
My question is similar to this one and this one , but there is
I have asked a similar question previously, but posting a new one as I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.