SQL Server, a LEFT join can not only join a table, it can also be a result set

Source: Internet
Author: User
SELECT  Ma.name as Makename,        m.id as ModelID, m.name as ModelName, m.warranty as        modelwarranty,        s.i D,S.NAME,S.STYLEWARRANTYFROM dbo. Model Minner JOIN dbo. Make Ma on Ma. Id = M.makeidleft JOIN (select    row_number () over (PARTITION by S1. ModelID ORDER by S1.updatetime DESC) rowID,                            S1. Id,s1.name,s1. Modelid,v.value.value (' (value/input/content) [1] ', ' varchar ') as Stylewarranty from      dbo. Style S1                            INNER JOIN dbo. Stylepropertyvalue V on S1. Id = V.styleid                    where V.propertyid = 398                ) A        where   rowid = 1) S on S.modelid=m.idwhere m.isenabled=1 A ND m.isremoved=0

  

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.