Tell me more ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am developing a social networking website, and in this website I am giving friend suggesstion, friend list, mutual friends list (between logged in user and another user). I am doing all this very well in SQL. I have following tables in MS SQL 2008.

  1. CountryMaster (CountryID (Pk), CountryName)
  2. StateMaster (StateID (Pk), StateName, CountryID (Fk->CountryMaster.CountryID))
  3. CityMaster (CityID (Pk), CityName, StateID (Fk->StateMaster.StateID) )
  4. UserMaster (UserID (Pk), UserName, FName, LName, Email, BirthDate, CityID (Fk->CityMaster.CityID))
  5. UserFriends (TableID (Pk), UserID (Fk->UserMaster.UserID), FriendID (Fk->UserMaster.UserID), Status (eg. 1.Accepted,2.Pending) )

Now in redis I have created a hash for UserMst like

hset **UserMst:id hash**

example = hset UserMst:1 [UserID:1, UserName:ryan, FName:ryan, LName:Briones, Email:ryan@somedomain.com, BirthDate:1984-05-31, CityID:548]

I have created a set for logged in user's friend list. sadd "FriendList:id array

example = sadd "FriendList:1 [548,4785,6589,214587]"

Another set I have created for logged in users.

sadd "LogginUsers" 1

Now I want friend suggestion, which give me a users list which is not in my contact list but it exists in my friend's contact list, and order should show first the maximum mutual count, then citywise (logged in user's city)

I have read documents, posts, blogs. But I can not understand how can I do this... I think I have to use it out of box, but I don't know how. If someone can guide me, I will definitely reach the solution.

share|improve this question

migrated from stackoverflow.com Jul 26 '12 at 12:53

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.