如題,有勞指點。

解决方案 »

  1.   

    类似这样的?SELECT ProductName
    FROM Northwind.dbo.Products
    WHERE UnitPrice =
          (SELECT UnitPrice
           FROM Northwind.dbo.Products
           WHERE ProductName = 'Sir Rodney''s Scones')
      

  2.   

    (NOT)IN   在子查询返回的行集中搜索
    (NOT)EXISTS  子查询能否返回行集
    字段=(SELECT ..) 字段=子查询产生的一个值,记住,只有一行一列
    常数>(SELECT COUNT(...) ... )  子查询返回一个INT型数据
      

  3.   

    現在有這樣的應用:
    TabA結構與值如下
    --------------------------
    A  B   C   D 
    --------------------------
    1  1  1    1
    2  2   2   3
    1  2  3    2
    2  1  3    4
    ---------------------------
    值只表示填充位
    TabB
    -------------------
    A   B
    ----------------
    1   3
    2   4
    1   5
    -------------------當tabb.a 和  tabb.b  等於  Taba.a 和tabb.b 時顯示Taba中的所有列--類似以上的應用怎樣寫查詢?
      

  4.   

    select a.* from taba a left join tabb b on a.a=b.a and a.b=b.b where
    b.a is not null
      

  5.   

    select 1,2,3,2 union all
    select 2,1,3,4create table tabb
    (
    A int,
    B int

    insert tabb
    select 1,1 union all
    select 2,4 union all
    select 2,1
    select * from taba
    select * from tabbselect a.* from taba a left join tabb b on a.a=b.a and a.b=b.b where
    b.a is not nullA           B           C           D           
    ----------- ----------- ----------- ----------- 
    1           1           1           1
    2           1           3           4