Mysql-how to write SQL statements for MySQL ?? Three-table query ~~~ Please come in and help me ~~~~~

Source: Internet
Author: User
Now I have three tables: Table 1: pre_common_member_profile: uid (user's uid), gender (gender), birthyear (year of birth), birthmonth (month of birth ), birthday (date of birth) Table 2: pre_home_friend: uid (user's uid), fuid (uid added as a friend) Table 3: pre_home_friend_request: fuid (the person who sent the friend request ), uid (to whom it is sent): query table 1, but certain conditions are excluded. Query the five above in Table 1... mysqlphpsql

Now I have three tables:
Table 1:
Pre_common_member_profile:
Uid (user's uid ),
Gender (gender ),
Birthyear (year of birth ),
Birthmonth (the month of birth ),
Birthday)
Table 2:
Pre_home_friend:
Uid (user's uid ),
Fuid (uid added as a friend)
Table 3:
Pre_home_friend_request:
Fuid (the person who sends the friend request ),
Uid (Sent)

Requirements:
Search for table 1, but exclude certain conditions.

Query the five fields in Table 1. the condition is uid = 570 and uid cannot be equal to (these two conditions: 1. the fuid value of uid = 570 in table 2. 2. fuid = 570 uid value in Table 3 .)

Try to write a statement more efficiently.

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.