Book表                                                      Id
Title
Author
PublishDate
ISBN
WordsCount
UnitPrice
ContentDescription
AuthorDescription
EditorComment
TOC
Clicks
CategoryId
PublisherIdCategories表Id
NamePublisher表Id
Name
现传过来一个 categories的Name 和一个出版社的Name 如何根据这两个值 得到符合条件的图书!
列如:categories的name="ASP"   出版社Name="北京" 怎么查询

解决方案 »

  1.   

    select m.*
    from book m , Categories n , Publisher o
    where m.PublisherId  = o.id and m.CategoryId  = n.id and n.name = 'ASP' and o.name = '北京'
      

  2.   


    select *
    from book m 
    inner join Categories m.PublisherId  =n.id  
    inner join  Publisher m.CategoryId  = o.id 
    where n.name = 'ASP' and o.name = '北京'
      

  3.   

    select *
    from book a 
    left out join Categories b on a.PublisherId  =b.id  
    left out  join  Publisher c a.CategoryId  = c.id 
    where b.name = 'ASP' and c.name = '北京'
      

  4.   


    select *
    from book a 
    left out join Categories b on a.PublisherId  =b.id  
    left out  join  Publisher c on a.CategoryId  = c.id 
    where b.name = 'ASP' and c.name = '北京'