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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:21:30+00:00 2026-05-20T10:21:30+00:00

Hi and thank you again for looking into this question. I have one mysql

  • 0

Hi and thank you again for looking into this question.

I have one mysql table for visitors. They can add their favorite singers to a list. So the table looks very simple:

user_artist_favorites
id
user_id
artistName

Let’s say Moonwalker got 4 favorite singers:

 1. Michael Jackson
 2. Elvis Presley
 3. Ray Charles
 4. Stevie Wonder

The user Tester got also 4 favorite singers:

 1. Michael Jackson
 2. Ray Charles
 3. Stevie Wonder
 4. Lady Gaga (sorry folks)

What I would like to do now is compare the two users and output something like: Moonwalker & Tester have 75% the same taste in music.

How to start? Can anyone point me to the right direction please?

Thanks in advance for any help you can provide.

  • 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-20T10:21:31+00:00Added an answer on May 20, 2026 at 10:21 am
    Select T1.user_id
        , Count( T2.user_id ) / Count( T1.user_id ) * 100.0 As PercentMatch
    From user_artist_favorites As T1
        Left Join user_artist_favorites As T2
            On T2.artistname = T1.artistname
                And T2.user_id = 'Tester'
    Where T1.user_id = 'Moonwalker'
    Group By T1.user_id
    Union All
    Select T1.user_id
        , Count( T2.user_id ) / Count( T1.user_id ) * 100.0
    From user_artist_favorites As T1
        Left Join user_artist_favorites As T2
            On T2.artistname = T1.artistname
                And T2.user_id = 'Moonwalker'
    Where T1.user_id = 'Tester'
    Group By T1.user_id
    

    The first part of the Union All query returns the percent that Tester is like Moonwalker. The second query returns the percent that Moonwalker is like Tester.

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

Sidebar

Related Questions

Thank you for looking into this! I doing one of those django tutorials from
First off, I want to thank you for looking into my question as I
This is more of an open question rather than looking for one specific answer.
OK, I hope I explain this one correctly. I have a struct: typedef struct
I realize that this is a question that will probably not have a single
I'm looking for some advice on how to do this. I want to have
I am going to totally re-ask this question. So this is one big edit
Once again my silliness has struck. I would like to thank everyone who helped
I think I've seen this done once, but I cannot find it again after
thank you for reading. For a shell command to wget, something like this works:

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.