Join query for multiple access tables

Source: Internet
Author: User
Access supports join operations on three or more tables. However, brackets must be added and join operations must be performed on one layer. For example:
Select *
From (AA left join BB on AA. A = BB. a) left join CC on CC. A = BB.;
I saw Zhu Kai's reply and tried it. No problem. Thank you, Zhu Kai! I am sorry to mislead you. Correct the following:
Previous errors:
Note one problem here. When using a join statement to query, only the on condition after the first join can add multiple conditions, and only one condition can be followed, you can add multiple conditions, but enclose them in parentheses, for example:
Select *
From (CC left join AA on AA. A = cc. a) left join BB on BB. A = AA. A and AA. B = BB. B

Select *
From (AA left join BB on AA. A = BB. A and AA. C = BB. C and BB. C = AA. a) left join CC on CC. A = BB. a,
Select *
From (AA left join BB on AA. A = BB. A and AA. C = BB. C and BB. C = AA. a) left join CC on CC. A = BB. A and AA. C = cc. C will prompt: "expressions not supported" error.

Correct:

Note one problem here. When using a join statement to query, only the on condition after the first join can add multiple conditions, and the following can also add multiple conditions, but it should be enclosed in parentheses, such:
Select *
From (CC left join AA on AA. A = cc. a) left join BB on BB. A = AA. A and AA. B = BB. B
I encountered this problem today and shared it with you.

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.