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

The Archive Base Latest Questions

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

There are users that can be referenced by an id as seen in the

  • 0

There are users that can be referenced by an id as seen in the table below:

users:
user_id

I have attempted at a solution for keeping track of show views

tvshow_hits:
user_id|show_id

There is also a table with details in it:

tvshows:
show_id|name

But that is not required I’m open to change. I feel it isn’t necessary to keep track of individual views more if they have watched it, since unlike music tv shows and movies are only watched once, and if they are watched again they don’t carry any “weight”.

So now I’ll work backwards:
The resulting page should look like this:

People Who Watch Also Watch

South Park 40%
Family Guy 20%
Something 10%

So, what I need is a query and (if needed) PHP code to

Select the shows (in order of P DESC), the amount of people who watch it compared to the other shows (that have been watched by users who have watched ) in percentage form AS P WHERE the show(s) have been watched by users who have watched LIMIT x

I hope that makes sense that is my best way of explaining it, feel free to think of another way to do what I’m trying to do. All suggestions and help welcome.

  • 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-05-13T00:53:26+00:00Added an answer on May 13, 2026 at 12:53 am

    Not tested but something like this:

    SELECT name, Count(1) AS no_users
        FROM
            tvshowhitdetails 
        WHERE
            userid IN (
                SELECT userid
                   FROM
                       tvshow_hits
                   WHERE
                       showid = @showid
                  )
            AND
            showid <> @showid
    GROUP BY
        name
    ORDER BY
        no_users DESC
    

    will give you the name of a show (tvshowhitdetails here is a view which joins your show_hits and show details table) and the number of people who have watched it. You can then get the total number of users in another query to work out your percentage.

    Update
    Your tvshowhitdetails view looks like this:

    CREATE VIEW tvshowhitdetails
    AS
    SELECT     tvshow_hits.UserId, tvshow_hits.ShowId, tvshows.Name
         FROM         tvshow_hits LEFT OUTER JOIN
                      tvshows ON tvshow_hits.ShowId = tvshows.ShowId
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to see users that have certain security role assigned? I'm
Are there any DHTMLX users out there? We have an app that is being
Is there anyway I can build a Select statement that uses the Contains function?
How can I revert back to the default function that python uses if there
Hy, In my application there will be: profiles: they are just users that make
I'm using the ASP.NET SQL Membership Provider. So, there's an aspnet_Users table that has
Is there a Subversion host that: lets end-users file bug reports arranges bug reports/customer
Is there a third party tool or something similar that will allow users to
For example, say we have a ticketing system that can be configured to offer
Currently I have a C# solution that contains a class library, installer, and setup

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.