• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Active records - "smart" select

yes it is, it's not very elegant, but it works
// http://sqlfiddle.com/#!2/444e5/17


But this is not what I want. I need to select the communities the user MAY want to follow. So how I do select the communities that probably interest the user? I select all users from the communities he follows and check the most common communities they follow that I don't have.

I did it:

The problem is that it returns only communities that there's a user that follow another community as me. I want to show all communities that I don't follow, ordered by this "probably interest".

It's ready

// http://sqlfiddle.com/#!2/444e5/17


so ??

Still no updates?

Sorry for the wait. Still not that, you are only selecting and ordering the communities by the number of followers it has. I want to suggest communities that a user may want to follow.

For example:

Communities: 1,2,3,4,5,6,7,8,9,10,11,12,13,14

User A follows: 1,2,3,10,11,12,13,14

User B follows: 1,2,4,10,11,12,13,14

User H follows: 1,4,8

User C follows: 5,6,7
User D follows: 5,6,7
User E follows: 5,6,7
User F follows: 5,6,7
User G follows: 5,6,7
User I follows: 5,6,7
User J follows: 5,6,7

Let's suggest the user A the the communities he may want to follow ordered by this "may" param, in this case would be:


I've done part of it. The problem is that it doesn't return communities that hasn't at least one user that follow another community as user A. In this case, my query would return only:


SQL Fiddle:

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.