Jump to content

Querying to find amount of exact same records and...


Recommended Posts

Hi,

 

My database currently consists of Users, Tracks and Ratings. Currently there are two users who have rated about 4 items. This is how it looks.

 

+------+-------+--------+

| user | track | rating |

+------+-------+--------+

| 9999 |    1 |      4 |

| 9989 |    1 |      1 |

| 9989 |    2 |      1 |

| 9989 |    3 |      5 |

| 9999 |    2 |      1 |

| 9999 |    3 |      1 |

| 9999 |    4 |      5 |

| 9989 |    4 |      5 |

+------+-------+--------+

8 rows in set (0.00 sec)

 

 

So im trying to figure out if 2 given users have rated the same items or not using SQL. Anyone that can help me out? I am also trying to find out how i would work out WHICH items the two given users rated.

 

 

OK So i have this query how would i left join it, bearing in mind all this data is on one table.

 

SELECT * FROM userratings WHERE (user = 9999 OR 9989) AND track = 1 AND rating = 1;

You want one query for each user, and left join them....

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.