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 479509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:47:58+00:00 2026-05-13T00:47:58+00:00

So firstly here is the relevant table structure: TUBE_VIDEOS —— id video_name TAGS —-

  • 0

So firstly here is the relevant table structure:

TUBE_VIDEOS
------
id
video_name

TAGS
----
id
tag_name
tag_type [either set to "actor" or "tag"]

TUBE_VIDEO_TAGS
----
tube_video_id
tag_id

I had asked a question a while back about how to use this data to get related videos: here — this solution basically took videos with the most common similar tags to decide which were most similar. Since then my database has been modified a bit to show what a tag is describing. So for example “Tom Cruise” is set to tag_type “actor” whereas “explosion” is set to tag_type “tag”. What I’d like to do is adjust the query to weigh actors heavier than tags. So essentially we would say to MySQL: Give me a list of video ID’s with the most matching actors, in the event of tie use the most matching tags next.

  • 1 1 Answer
  • 2 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-05-13T00:47:59+00:00Added an answer on May 13, 2026 at 12:47 am

    You can do that with just a lot of joins. The following query starts with the current video tv. It looks for all tags belonging to that video tvt. Then it looks for all other video’s sharing one or more tags rtvt. For the related video’s, it looks up the tag details rt and the video details rtv.

    select      rtv.video_name
    ,           sum(case when rt.tag_type = 'actor' then 1 else 0 end) ActorCount
    ,           sum(case when rt.tag_type = 'tag' then 1 else 0 end) TagCount
    from        tube_videos tv
    left join   tube_video_tags tvt
    on          tvt.tube_video_id = tv.id
    left join   tube_video_tags rtvt
    on          rtvt.tag_id = tvt.tag_id
    and         rtvt.tube_video_id <> tv.id
    left join   tags rt
    on          rt.id = rtvt.tag_id
    left join   tube_videos rtv
    on          rtv.id = rtvt.tube_video_id
    where       tv.id = <YourMovieId>
    group by    rtv.id, rtv.video_name
    order by    ActorCount desc, TagCount desc
    

    After all the joins, you can count the various badge types and order by them.

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

Sidebar

Related Questions

Having a bit of a problem. Firstly, here's my table structure. Table doc_perms id
Firstly, here is the relevant part of the code: stokes_list = np.zeros(shape=(numrows,1024)) # 'numrows'
Firstly here is my ruby and rails version with a couple of the important
Firstly, here's my script: #!/usr/bin/python import sys, os sys.path.append('/home/username/python') sys.path.append(/home/username/python/flup) sys.path.append(/home/username/python/django) # more path
Firstly, the bash script works fine when I call it outside of ant. Here
Background: Firstly, I'm unsure if this is even called a metabox Here's an example
Firstly, here's my Makefile, it's really, really cool. It generates an executable for every
Firstly here is the problem: A positive integer is called a palindrome if its
Firstly, YES, this is a duplicate issue that's been asked 100 times on here,
I've got a chicken and egg problem here. Firstly I've got a userprofile class

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.