Blog Content

    티스토리 뷰

    27.MS_SQL 2008 - Join_Left(조인문) [3]

    반응형

    --3개테이블조인

    --카테고리명, 상품명, 판매가, 코멘트

    --ansi 오라클에서사용하는표준

    Select

           c.CategoryName, p.ModelName, p.SellPrice, r.Comment

    From

           Categories c Join Products p

                 On c.CategoryID = p.CategoryID

           Join Reviews r

                 On p.ProductID = r.ReviewID

    Go

     

    --Sql전용문법

    select c.CategoryName, p.ModelName, p.SellPrice, r.Comment

    From Categories c, Products p, Reviews r

    Where

           c.CategoryID = p.CategoryID

           And

           p.ProductID = r.ProductID

    Go



    반응형

    Comments