Recommend friend SQL based on second-level contacts and friend SQL

Source: Internet
Author: User

Recommend friend SQL based on second-level contacts and friend SQL

Friend table structure

Drop table if exists friend;
Create table friend (
Uid bigint not null comment 'user id ',
Friend_uid bigint not null comment 'user ID applied to be added as a friend ',
Sys_create_date datetime not null comment 'application time ',
Sys_last_update datetime not null comment 'Update time ',
State tinyint not null comment 'friend state 0: delete, 1: Apply for friend, 2: friend ',
Primary key (uid, friend_uid)
) ENGINE = InnoDB default charset = utf8 COMMENT 'friends table ';


Select friend_uid from

Friend where state = 2 and
Uid in (select friend_uid from friend where uid = 13 and state = 2)

And friend_uid not in (select friend_uid from friend where uid = 13) and friend_uid! = 13 limit 6


The uid is the ID of the current user, and the user whose id is 13 queries two-level contacts and friends.



How are the first and second connections of qq alumni displayed? Why do some people have one, but some do not?

You can see that some of your alumni have shown their first contacts and second contacts, because these alumni have upgraded to the latest friend version, after the upgrade, the friend version adds industry, company, and other related features. However, the friend version is still in the inner renewal stage, so only some users are eligible for experience, if you want to use a friend version of alumni, you can invite friends who have been upgraded to a friend version to join us. For more information, please refer to and sincerely hope to help you, thank you!

How can QQ alumni close their second-level contacts or prevent my friends from seeing other contacts?

1. Go to the alumni page and click "Settings"-"" privacy settings "in the upper-right corner of the page. 2. On the privacy settings page, you can set the privacy of your data and homepage, you can set who can view and view my information, including: visible to all users, visible to my alumni and my friends, visible to my classmates and my friends, visible to my friends, visible to my classmates, and only visible to myself;
3. You can also set who can send me a small note and who can send me a friend application, which also includes: all people, my alumni and friends, my classmates and my friends, my friends, my classmates, do not accept.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.