Left connection between two SQL query statements

Source: Internet
Author: User

The code is as follows:


A left connection is also used inside a subquery

Select a.id, a.thumbnail,a.name,a.marketprice,a.memberprice ,a.personname,a.status, a.recieveorderdate,a.tracknumber,a.contact,a.reportsenddate,b.tracknumber,a.reportdownloadpath from  (Select od.id, ps.thumbnail,ps.name,od.marketprice,od.memberprice ,od.personname,od.status, Od.recieveorderdate,ol.tracknumber,ol.contact,od.reportsenddate,od.reportsendorderlogisticid, Od.reportdownloadpath from orders.order_detail odleft join orders.order_logistics  olon od.recieveorderlogisticid = ol.id left join orders.product_snapshot  ps on od.productsnapshotid=ps.id where od.valid=true and ol.valid=true  and od.orderId=? )  a left join  (select ol.tracknumber ,od.id  from orders.order_detail od left join orders.order_logistics ol on  od.reportsendorderlogisticid=ol.id where od.Valid=true and ol.valid=true and od.orderid=?)  bon a.id=b.id

INNER join is equivalent to join
You can understand that join is an abbreviation for INNER join.
The left join is equivalent to the left OUTER join
Right join is equivalent to right OUTER join

This article is from the "Nothing-skywalker" blog, please be sure to keep this source http://tianxingzhe.blog.51cto.com/3390077/1680276

Left connection between two SQL query statements

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.